mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-01 12:43:17 +07:00
Compare commits
831 Commits
Author | SHA1 | Date | |
---|---|---|---|
4c5c122aa6 | |||
bee5abe269 | |||
220d0c24c7 | |||
2f5c2edb22 | |||
721e4c3367 | |||
2f2a90e464 | |||
81a06ff6ed | |||
dfc02c42d9 | |||
ac7d3d7f84 | |||
874e5099b0 | |||
4a3337d069 | |||
123f6df529 | |||
341cf69e13 | |||
f7b503e36b | |||
beaceb0089 | |||
03509eca9b | |||
2c9c274411 | |||
1c85db7f9e | |||
d259dd49a2 | |||
ea20ae1fbd | |||
383c74bb06 | |||
b4593b7df0 | |||
9b92c9db92 | |||
a357b6a054 | |||
0bc2f7ce96 | |||
e2e76ea34f | |||
719018955c | |||
4c903565c9 | |||
fc60088a95 | |||
a7f90656b3 | |||
0cd4af837e | |||
96e47f9be7 | |||
eca40cad4d | |||
4e864eae3b | |||
49a0bad962 | |||
b971d8f4ad | |||
fca0924fa9 | |||
8dfe214356 | |||
f2d6820ca2 | |||
705c2a5785 | |||
5e33fdb0d9 | |||
dab978c436 | |||
2cc925b655 | |||
4ce6f3c3df | |||
b3bf0f3990 | |||
8426bf89fd | |||
d7c3e33a96 | |||
17ef667e04 | |||
295b5da700 | |||
e820a5d75b | |||
2c8682d5e6 | |||
87993cd853 | |||
e0dd9c9560 | |||
28853c9f3b | |||
608ad1a0cf | |||
257e4c088d | |||
7b145b5fae | |||
253459691c | |||
cb5db3f888 | |||
52d2b3b70b | |||
fa5fbefff9 | |||
256b466cc4 | |||
57f4a60e24 | |||
2e289f30e2 | |||
bc0d607611 | |||
1fa3ba1b16 | |||
d8d1da5d6d | |||
094bc8ae17 | |||
48aac87d46 | |||
31971c78cd | |||
13760f5b16 | |||
c644f654ce | |||
9adda12e86 | |||
6db8a6c378 | |||
a34eeedd37 | |||
35bc046b26 | |||
64e9bb0e79 | |||
19a01870e7 | |||
c4560dd084 | |||
0313f578ce | |||
d068c17d9e | |||
8eebeae48a | |||
da9dadf09c | |||
e06e40278f | |||
6473b1c04c | |||
7694412cb0 | |||
e990e98a54 | |||
b2d037d560 | |||
4beeea41b4 | |||
8e80635955 | |||
c8837583fc | |||
bb36513e49 | |||
5402397d9f | |||
f6b4601c63 | |||
ed62711289 | |||
2cb9b82943 | |||
4f420be5bd | |||
cf40c1e950 | |||
91936faf85 | |||
ca319bd10e | |||
4d3cfaa653 | |||
c8b716540c | |||
1cecc2cc99 | |||
5137c78ee5 | |||
c37021df01 | |||
c6e99860cd | |||
05b4ac2afb | |||
91bd11146c | |||
8ace7bdc6e | |||
4bb4f1812c | |||
7bd9f10bef | |||
0b38e86c65 | |||
b717b2fcde | |||
216d501175 | |||
c2e811ce23 | |||
dbf50bf9e0 | |||
947009a717 | |||
ca910e5511 | |||
f31d416e6e | |||
36cb9fb0fc | |||
6a8a2abd3c | |||
c88f07696b | |||
0b33ef444f | |||
604ffba8e1 | |||
a3727c20a4 | |||
6a9b0017a4 | |||
3b2ce6cae6 | |||
c61b9256d1 | |||
09e08a3554 | |||
f31bef6a30 | |||
1a216636c5 | |||
7eec3d790d | |||
5afed16e5f | |||
14fa980966 | |||
39491a0fba | |||
c6b6dabbb9 | |||
e1a9afe11c | |||
6449431df2 | |||
60ff774608 | |||
dd591f1661 | |||
fefbd7a497 | |||
10f1a63300 | |||
a06325cfba | |||
e0b7f34ba7 | |||
e02a1810e6 | |||
55ab748aaa | |||
bb0acc6313 | |||
17fd1a694b | |||
454ef11759 | |||
e3396c6572 | |||
3beda962f3 | |||
1f97ce0215 | |||
00f360b99d | |||
9882bed066 | |||
e8855efe7c | |||
4067ce8b81 | |||
d5790807c8 | |||
ed61605069 | |||
d0e7f46ec4 | |||
ef477a1dd7 | |||
9149639a33 | |||
2fdb2200a0 | |||
15c43e89cd | |||
b0559f7f8e | |||
a41bc75590 | |||
6ebd1e5184 | |||
9ad81048ce | |||
8cfcbb030f | |||
254ecd5a66 | |||
0461bf14b2 | |||
7e5351f399 | |||
fe944a16b5 | |||
909090903e | |||
75a1b03f39 | |||
a47644812e | |||
23393c46d7 | |||
3c6827c2c3 | |||
de8537f42a | |||
ada1ce86b7 | |||
7c13389546 | |||
7627a79c01 | |||
39faaac1d3 | |||
b3152daa8d | |||
6db6ddbab2 | |||
c870bc9a3a | |||
f5f14c3aa3 | |||
e831babc61 | |||
c7736a605a | |||
a9a6d1986e | |||
c342ca379e | |||
cc316409b0 | |||
a8dafdc2b5 | |||
f8646352c6 | |||
3cbec713b8 | |||
4186db28f7 | |||
18f02c9c99 | |||
15b99e2a8d | |||
e9a7adef28 | |||
bceb2ef3d8 | |||
86e7315da6 | |||
0741f2b23a | |||
0c4c4d5441 | |||
abfbe6a46b | |||
62aa8428dd | |||
e6a3eb1258 | |||
0ce7328fd7 | |||
6e76d3f012 | |||
ac40fdb561 | |||
890ea4bca9 | |||
113fcc64e3 | |||
afefcaf556 | |||
df4388ca60 | |||
fa18c2b29f | |||
399ab79d14 | |||
9601a19811 | |||
60ff151fc1 | |||
121cb19a65 | |||
739ccacdc4 | |||
cff0bdeaa3 | |||
70d858dd49 | |||
3340d60d91 | |||
57c17e3349 | |||
356e1a5128 | |||
633920d001 | |||
406f3c410a | |||
17349dafc1 | |||
962f570776 | |||
f66ac5d5a6 | |||
3f466981fc | |||
fd62612e9e | |||
26791e8412 | |||
f42065d568 | |||
912f27c42c | |||
86e1ccdd8d | |||
36ec0200a6 | |||
1686147b24 | |||
ecc8611061 | |||
abefdb50ee | |||
2ea6ca5b36 | |||
a83d4379b1 | |||
fbc8407035 | |||
6972aed899 | |||
d2f58713aa | |||
068c794af7 | |||
1e119b6d1a | |||
77721f6637 | |||
d731e56579 | |||
e5b90e33c6 | |||
849315646a | |||
d891a81b7f | |||
5098017251 | |||
2da85f306f | |||
1f94ad201f | |||
862f206cd2 | |||
81964ae791 | |||
b7d1d9c9a9 | |||
c5e4d55c3b | |||
d74064b67a | |||
8862a73fdd | |||
7b44f7e007 | |||
ff5499165a | |||
b3cd6b4dab | |||
ce02569aea | |||
f1c04eb1eb | |||
77aeac1761 | |||
569522d50d | |||
ea8be20255 | |||
d6f700217a | |||
1015b3659d | |||
03359ef1ab | |||
fd9aae59b0 | |||
9af1e7006f | |||
5efdcae81a | |||
f0fb8731a5 | |||
5a15252e66 | |||
c0c6e403b6 | |||
d0677c93b9 | |||
466908db61 | |||
8dbd6b7684 | |||
5a40a5875d | |||
790a41a722 | |||
62c7ba2bee | |||
41797e3af9 | |||
c6150c6a2b | |||
19b09596c6 | |||
4ec398d39a | |||
6bbaac9c49 | |||
012f269570 | |||
09222f42ae | |||
403191b6b6 | |||
02cba443ad | |||
31fa0d7883 | |||
f9caa0457d | |||
248394635c | |||
a094f682be | |||
45213ad923 | |||
385e3b6e96 | |||
5453c1f4f0 | |||
787c534f64 | |||
d812e938ac | |||
7de94e6400 | |||
68fbd80105 | |||
02445f719d | |||
215b040f0d | |||
925ede2589 | |||
d1510a82d5 | |||
808e74aed5 | |||
f51d00d350 | |||
c8111b053c | |||
294f03454a | |||
5d27b8f90e | |||
87e62cbb7f | |||
2c29e8b9a1 | |||
04a9e3b562 | |||
4adaa73d25 | |||
234594684c | |||
3c0527bec1 | |||
c5d41cd3f1 | |||
601cabfd2a | |||
81c750c6d7 | |||
0661130e18 | |||
4244b92ac6 | |||
e9595da9ac | |||
b77ec78d01 | |||
96d8c1e901 | |||
8816b6ff48 | |||
9205a596c9 | |||
6fc20c9b7f | |||
eb07280d5c | |||
eaaab1cec3 | |||
853381d0bb | |||
1394617d60 | |||
093498a0a1 | |||
d2241010ef | |||
a0f02c17c0 | |||
bb5257e07d | |||
f687ff8f21 | |||
537c66b2ea | |||
073c2e666b | |||
465e63b28c | |||
b8f0b066dc | |||
9e663851ce | |||
ad196941ed | |||
f8e867a9ff | |||
8cb01730c7 | |||
ebba1db2c3 | |||
716331904e | |||
2ad63ddbd3 | |||
c4606c9269 | |||
7dcb43c768 | |||
691c5309aa | |||
84b222366a | |||
b98ed88402 | |||
0ca827ae3b | |||
16b0a25bf6 | |||
fa0af5c382 | |||
db36b200b1 | |||
7cfd76cc1b | |||
682b1f5e44 | |||
7b56e4491e | |||
acc1fdb337 | |||
e3286d1234 | |||
83019fade2 | |||
83b3d4a8f9 | |||
56273e234f | |||
48a00b4d3f | |||
f641885a8d | |||
9457ce6e2b | |||
a31f8b1a2b | |||
ffded4a3e8 | |||
9e6b9d7d70 | |||
7d45057bba | |||
c4fd8b0739 | |||
49088ede98 | |||
3543ed1ef8 | |||
9bd0fdbc18 | |||
c5d29cf8e3 | |||
c5e0997b44 | |||
ee084d3176 | |||
c256f0c9cb | |||
d84365cd03 | |||
3c52e818b1 | |||
188598ef9d | |||
f8b8d766d5 | |||
15a6402865 | |||
91bd6b26c2 | |||
9dae796baf | |||
6d9aef83a3 | |||
bd5a0d94b6 | |||
5405f14867 | |||
cb25b9c13a | |||
e63d25d41f | |||
2a7ae24c8e | |||
e68a74a71c | |||
67152eb712 | |||
83bdf158fa | |||
5e240ab99f | |||
0fae072f07 | |||
e0561697dc | |||
3aa0f17b55 | |||
8b218279a3 | |||
90b6355bf0 | |||
84f23853b7 | |||
a4001afbd6 | |||
cfbb105cb6 | |||
c549015370 | |||
9e22b87414 | |||
7961bc11b1 | |||
87f807365d | |||
25d9bbc737 | |||
d2f865c91a | |||
a13373a271 | |||
a764546381 | |||
380b68048b | |||
4dcf9cd2ab | |||
f3641e0c33 | |||
d35633ec7a | |||
7eea3d82f6 | |||
57ecdba082 | |||
db03758c66 | |||
82837572d4 | |||
8efcf46b31 | |||
4391cf8a4c | |||
87a69f94d9 | |||
c12fad850b | |||
47b8d68850 | |||
530929f741 | |||
a965723128 | |||
9845a63f5c | |||
4af7e96d03 | |||
13a3d9d0a9 | |||
9d042b2683 | |||
7a59874419 | |||
8dee767b82 | |||
5fc5a95363 | |||
8ba779d78e | |||
04376074d2 | |||
262202d43f | |||
f64dddeeb4 | |||
1d50c4a8cd | |||
d313593fee | |||
5753a00ef5 | |||
38731c6386 | |||
9f400a0dfd | |||
ba020e3463 | |||
c0d425d939 | |||
4752a51595 | |||
10608f5908 | |||
d01ec214f2 | |||
6158538131 | |||
dd27d4eb81 | |||
248d04f73c | |||
c5e40d9067 | |||
e0ed1ad0ef | |||
2907f8a584 | |||
52691651dc | |||
b9404683e1 | |||
70954fb6f8 | |||
65e65163cd | |||
41397ce45e | |||
c09954033f | |||
7cec1987ac | |||
739e40fb5e | |||
9dec5892e7 | |||
94616818f0 | |||
4f0d9003dc | |||
b2edfc47dd | |||
6bd872ad2c | |||
03eb8cc744 | |||
9687dd1d8a | |||
2df0d2b443 | |||
0e56c0b653 | |||
0469a6f681 | |||
325413a824 | |||
b84dd3ce25 | |||
190220c10d | |||
4fb049a68b | |||
3e0678b50f | |||
5b06192e7c | |||
b419442896 | |||
49b8b7e301 | |||
b1776b79c8 | |||
a48ff666f8 | |||
3bffbad95a | |||
18041fdab5 | |||
b36d2222e6 | |||
50ffa593bb | |||
6cbc46fdb6 | |||
08c60fceea | |||
c30a9630bb | |||
0158fe2782 | |||
3a8557bcc6 | |||
d10d1e249b | |||
3ec1728de8 | |||
9c266d4158 | |||
0135ee2ed1 | |||
5c2618165a | |||
8123132b99 | |||
f5863fd356 | |||
cf0fdf35f2 | |||
8830cdd08c | |||
4960e3179f | |||
0f3f604249 | |||
5915f05b06 | |||
dccdb5ab67 | |||
9a01fd28ca | |||
d5cd6a4bd1 | |||
006301e81d | |||
4a38014043 | |||
a0ac655b06 | |||
41e56c42c7 | |||
4e8a0cfe8b | |||
ee72f2f8ad | |||
ed557fd2c3 | |||
d90cd153ee | |||
3376371dd8 | |||
a2b261d79a | |||
6c93dbd391 | |||
f58dc6eca1 | |||
5326f2302f | |||
b9a78a31fb | |||
ba69b25cab | |||
a6533acdd4 | |||
d3b37e3d0d | |||
f3a1262ff6 | |||
933abd531a | |||
67ed7f234b | |||
f90accffb3 | |||
93441b70bf | |||
67f23b6380 | |||
2937ad6e7a | |||
a5e5d07fcb | |||
30d8b321f4 | |||
405e57e429 | |||
58f376b118 | |||
b7d68d8225 | |||
9252820289 | |||
a5cc9fab25 | |||
4e5685a75d | |||
d475227ba5 | |||
38cb8b924d | |||
fdd83e94df | |||
ad112b7981 | |||
2b0d6e221f | |||
acee5b203f | |||
84e88e382f | |||
bbdc4e3b67 | |||
311eb9f3ba | |||
3dfd7a648b | |||
943f491830 | |||
dc9461a053 | |||
f2720d7b82 | |||
99161b7790 | |||
5de6285e1f | |||
14d702e830 | |||
9539b27b4a | |||
a4f7326577 | |||
9b297384e1 | |||
9d77946f60 | |||
6d21e6dc05 | |||
68c827cfcf | |||
d95ca49e8d | |||
03fd0b8719 | |||
ebe1c12c21 | |||
b46021d870 | |||
64ba54fc1b | |||
71571f685a | |||
10f86cb1a1 | |||
0f694c5087 | |||
9dfebd1adb | |||
3781acab4b | |||
cdfbf6d0f0 | |||
0ccb02802f | |||
a4572586dc | |||
cb3c752d1f | |||
383a511d0e | |||
cc55dbcaa8 | |||
e644692ccf | |||
96d5358317 | |||
3a473c9a22 | |||
40944de129 | |||
f9202d6b64 | |||
d99c8732ba | |||
2c559eae3d | |||
3a2ca44a8a | |||
17241e2689 | |||
ca33d01e9f | |||
3c6644f237 | |||
326dfd1e76 | |||
d9cf6f5ad6 | |||
ea50c7c0a2 | |||
6ca549dcaa | |||
d3760be2cc | |||
3454287b87 | |||
88c7757dc8 | |||
48cfea3f3e | |||
43cfa2b1a8 | |||
76cecacc5e | |||
d6e173ffc6 | |||
26701f2ec8 | |||
e934fe28b8 | |||
d384d9fe7e | |||
4eeaf5f99e | |||
fd2392db56 | |||
494dde7189 | |||
706dfca1e6 | |||
d613c975f6 | |||
fbe1419ce4 | |||
c844c7b6e4 | |||
8e5cc09df9 | |||
f4f8aec1f2 | |||
b44b7344e0 | |||
e01b2f0bf7 | |||
f7f8ecb931 | |||
4f0d810cbc | |||
47335179aa | |||
63c4aea452 | |||
898b6fa1f9 | |||
747c8838bc | |||
9d6b61c5af | |||
5108c81610 | |||
e58c704985 | |||
e9c783eef0 | |||
b44e5e009f | |||
8489dbf4de | |||
f23ae2e6f7 | |||
d2b233e45f | |||
320474a245 | |||
65ccfb36dc | |||
88fb99b592 | |||
9e7bc5c91f | |||
ca2f547a35 | |||
9f21c80d24 | |||
c4317135df | |||
a2dd688679 | |||
bd214a2dca | |||
2ee4653d1c | |||
0b3e0f451d | |||
0bfa897634 | |||
71db1e2cf1 | |||
16d1cd4766 | |||
1193cd100b | |||
e839a77d8c | |||
552df3f2b0 | |||
3109c941eb | |||
aa8706a5bf | |||
9afdee42e8 | |||
aa0e9403d8 | |||
5b00f068f3 | |||
8f39d3eddd | |||
9d87d1fd14 | |||
07ae2343d0 | |||
7b8bf7af6a | |||
0ac6f76d36 | |||
6c6203b683 | |||
0c9f8a8e7e | |||
1705daea72 | |||
58fbc33c3a | |||
3f42b7d5fb | |||
dd4f0db7bf | |||
7d026bfa6b | |||
6a70f864ec | |||
8e1cde2d0a | |||
de32d8b95f | |||
273096b82f | |||
4c045616f4 | |||
935e74fb40 | |||
a507be73b5 | |||
673dcaff6d | |||
2cbfd4fb41 | |||
0969980399 | |||
1fa2905bc6 | |||
790a48c30d | |||
4b69160eff | |||
7f805f22af | |||
f2972dcf18 | |||
2d488f53fd | |||
421187c870 | |||
1798f4d615 | |||
8039546df3 | |||
c6ad3d1a70 | |||
922f1e27b8 | |||
2d3750b36e | |||
51c7527bd8 | |||
2bf7ab0207 | |||
b3a84fc51e | |||
1330950cd5 | |||
afb57fca4e | |||
50344f4883 | |||
2b027bd9bc | |||
8f8207a1ca | |||
87e6c70743 | |||
e3d18718a9 | |||
cfa7bc51cd | |||
ade633f0da | |||
2cabcf2941 | |||
9ce4bd6f1b | |||
190ae49ac1 | |||
032bc86056 | |||
704c5180a4 | |||
e4fc767f9c | |||
1cf6a369bb | |||
14acb26bdc | |||
3ff7f9cedc | |||
98e937751c | |||
31b338b199 | |||
9e32964a24 | |||
4dcf2b117f | |||
6d8250310d | |||
3164116a42 | |||
747d45cb52 | |||
4b7ad1ca81 | |||
31ef16e586 | |||
dd1def7620 | |||
693a73d8da | |||
965eb91efd | |||
db9f610623 | |||
24fb306a50 | |||
919fe77b43 | |||
914c51cfb6 | |||
8d8c2bd524 | |||
7ef437ee9d | |||
0871fbb11b | |||
3039a720ed | |||
7f32ab318e | |||
ddcacf4760 | |||
2f951ef5cd | |||
5a081357b4 | |||
c4a64dff61 | |||
aad33a8e35 | |||
eae890b1b2 | |||
8fbd2ea6bb | |||
46161660dc | |||
de68427afb | |||
4ba36c5432 | |||
99e2d8d309 | |||
929f9cd52d | |||
4dba50d3af | |||
1c258f399f | |||
e05bc317ec | |||
44815f1f73 | |||
22f5ad47d2 | |||
a29956826a | |||
c11d023c03 | |||
cade5f7157 | |||
7964656607 | |||
970e2d5ebb | |||
5b09e1195e | |||
6fdecd40be | |||
159a09794e | |||
0be846de83 | |||
981c662f5d | |||
71c631cffb | |||
47387dd6e9 | |||
fec9df11d6 | |||
03f36220f4 | |||
1db0b0651d | |||
3f6c88dec7 | |||
2b938d931a | |||
71bd88f604 | |||
242082a22f | |||
b9db11a072 | |||
f381d2384c | |||
63d8fa1a9e | |||
dd1c34be39 | |||
1eb8e8f5cd | |||
0000679cbb | |||
7c5f2ab8e9 | |||
9d5e8ddc70 | |||
77bc79bd22 | |||
02c5ec11cc | |||
d2e09be6ce | |||
013ddc75a3 | |||
25abc4c776 | |||
4000f65b59 | |||
e14155415a | |||
9f16995a6f | |||
24ecbee4ea | |||
c71102b8a0 | |||
0815f5a8bb | |||
e5076cee70 | |||
bd85a2a227 | |||
976fb6996a | |||
06e916db9d | |||
46ac6f2211 | |||
47d1da0476 | |||
dfabf8ce29 | |||
9304663cff | |||
878561f9a8 | |||
9550c7aa45 | |||
ebeb82f894 | |||
aa2af38672 | |||
d27b4a7bc7 | |||
aeb5831c32 | |||
cb5e07baff | |||
9469267fb3 | |||
1d6dab3cd1 | |||
20d1b1c6f1 | |||
0d8d5d2f2c | |||
16267e1982 | |||
91d14c7068 | |||
340ab0b95f | |||
75c0e130e8 | |||
57a0907a18 | |||
3315fa09dc | |||
b132b4eb7c | |||
9145972d5c | |||
0ac43c03b2 | |||
46f009cce1 | |||
8d9a12ba84 | |||
76e0150bb5 | |||
ffc5b0249d | |||
a6aaa1db78 | |||
62beed29e3 | |||
fce9311522 | |||
b2e7a49dd5 | |||
99bbaa2a58 | |||
f7f5b1a7e1 | |||
e755fb7a69 | |||
3087ceb811 | |||
05e2b0d1e9 | |||
dd5c977988 | |||
c1c0acc338 | |||
409e055931 | |||
46a875ad7e | |||
7e81c058fb | |||
754ab9515b | |||
f866c880c2 | |||
eb21cb8fb3 | |||
aee6b953c3 | |||
21c3c8db47 |
16
.eslintrc.json
Normal file
16
.eslintrc.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"env": { "node": true, "jest": true },
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": { "ecmaVersion": 2019, "sourceType": "module" },
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:import/typescript",
|
||||
"plugin:prettier/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"plugins": ["@typescript-eslint", "jest"]
|
||||
}
|
38
.github/CONTRIBUTING.md
vendored
38
.github/CONTRIBUTING.md
vendored
@ -8,21 +8,16 @@ 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.
|
||||
* Add tests for it, so we don't break it in a future version unintentionally.
|
||||
* If editing the scripts, create a demo integration test.
|
||||
* Send a pull request to the develop branch with all the details.
|
||||
|
||||
Please make sure that you have [set up your user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. Strings such as `silly nick name <root@localhost>` look really stupid in the commit history of a project.
|
||||
|
||||
Due to time constraints, you may not always get a quick responce. Please do not take delays personal and feel free to remind me.
|
||||
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 commiting it.
|
||||
|
||||
```bash
|
||||
$ npm run format
|
||||
```
|
||||
|
||||
## Using setup-php from a Git checkout
|
||||
|
||||
The following commands can be used to perform the initial checkout of setup-php:
|
||||
@ -39,6 +34,19 @@ Install setup-php dependencies using [npm](https://www.npmjs.com/):
|
||||
$ npm install
|
||||
```
|
||||
|
||||
If you are using `Windows` configure `git` to handle line endings.
|
||||
|
||||
```cmd
|
||||
git config --local core.autocrlf true
|
||||
```
|
||||
|
||||
This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to fix and verify the code quality.
|
||||
|
||||
```bash
|
||||
$ npm run format
|
||||
$ npm run lint
|
||||
```
|
||||
|
||||
## Running the test suite
|
||||
|
||||
After following the steps shown above, The `setup-php` tests in the `__tests__` directory can be run using this command:
|
||||
@ -47,8 +55,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 appropiate template provided for a bug report or a feature request:
|
||||
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)
|
||||
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -1,5 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: shivammathur
|
||||
patreon: shivammathur
|
||||
custom: https://www.paypal.me/shivammathur
|
||||
|
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
37
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -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. -->
|
||||
|
26
.github/ISSUE_TEMPLATE/feature_request.md
vendored
26
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -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. -->
|
||||
|
29
.github/PULL_REQUEST_TEMPLATE.md
vendored
29
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,23 +1,19 @@
|
||||
---
|
||||
name: |
|
||||
🐞 Failing Test
|
||||
🐞 Bug Fix
|
||||
⚙ Improvement
|
||||
🎉 New Feature
|
||||
about: You found a bug, have a failing test, want to improve something or add a new feature
|
||||
name: 🐞 Bug Fix, ⚙ Improvement or 🎉 New Feature
|
||||
about: You found a bug, want to improve something or add a new feature
|
||||
labels: bug or enhancement
|
||||
|
||||
---
|
||||
|
||||
## A Pull Request should be associated with an Issue.
|
||||
## A Pull Request should be associated with a Discussion.
|
||||
|
||||
> 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 discussions,
|
||||
> so that the development can be pointed in the intended direction.
|
||||
|
||||
Related issue:
|
||||
Related discussion: <!-- Please link the related discussion -->
|
||||
|
||||
> 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
|
||||
|
||||
@ -27,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 YAML and link).
|
||||
|
||||
<!--
|
||||
- Please target the develop branch when submitting the pull request.
|
||||
|
30
.github/PULL_REQUEST_TEMPLATE/FAILING_TEST.md
vendored
30
.github/PULL_REQUEST_TEMPLATE/FAILING_TEST.md
vendored
@ -1,30 +0,0 @@
|
||||
---
|
||||
name: 🐞 Failing Test
|
||||
about: You found a bug and have a failing test?
|
||||
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.
|
||||
-->
|
30
.github/PULL_REQUEST_TEMPLATE/FIX.md
vendored
30
.github/PULL_REQUEST_TEMPLATE/FIX.md
vendored
@ -1,30 +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.
|
||||
-->
|
30
.github/PULL_REQUEST_TEMPLATE/IMPROVEMENT.md
vendored
30
.github/PULL_REQUEST_TEMPLATE/IMPROVEMENT.md
vendored
@ -1,30 +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.
|
||||
-->
|
30
.github/PULL_REQUEST_TEMPLATE/NEW_FEATURE.md
vendored
30
.github/PULL_REQUEST_TEMPLATE/NEW_FEATURE.md
vendored
@ -1,30 +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
30
.github/SECURITY.md
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The following versions of this project are supported for security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.11.x | :white_check_mark: |
|
||||
| 2.14.x | :white_check_mark: |
|
||||
|
||||
## Supported PHP Versions
|
||||
|
||||
This security policy only applies to the latest patches of the following PHP versions.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 7.3 | :white_check_mark: |
|
||||
| 7.4 | :white_check_mark: |
|
||||
| 8.0 | :white_check_mark: |
|
||||
| 8.1 | :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).
|
77
.github/workflows/docs.yml
vendored
Normal file
77
.github/workflows/docs.yml
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
name: Docs workflow
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 15 * * 6'
|
||||
jobs:
|
||||
create:
|
||||
name: Create
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-20.04, ubuntu-18.04, windows-2019, macos-10.15]
|
||||
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
- name: Save unix
|
||||
env:
|
||||
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||
version: ${{ matrix.php-versions }}
|
||||
if: matrix.operating-system != 'windows-2019'
|
||||
run: |
|
||||
echo "## PHP $version" >> "$file"
|
||||
printf "\n" >> "$file"
|
||||
echo "\`\`\`" >> "$file"
|
||||
php -m >> "$file"
|
||||
echo "\`\`\`" >> "$file"
|
||||
printf "\n" >> "$file"
|
||||
- name: Save Windows
|
||||
env:
|
||||
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||
version: ${{ matrix.php-versions }}
|
||||
if: matrix.operating-system == 'windows-2019'
|
||||
run: |
|
||||
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
|
||||
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
|
||||
php -m | Out-File -FilePath "$env:file" -Append
|
||||
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: lists
|
||||
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
|
||||
update:
|
||||
name: Update
|
||||
needs: create
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository }}.wiki
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: ${{ github.workspace }}
|
||||
- name: Combine
|
||||
run: |
|
||||
git config --local user.email "${{ secrets.email }}"
|
||||
git config --local user.name "${{ github.repository_owner }}"
|
||||
for os in ubuntu-20.04 ubuntu-18.04 windows-2019 macos-10.15 macos-11; do
|
||||
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
|
||||
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2; do
|
||||
if [ "$os" = "macos-11" ]; then
|
||||
cat lists/php"$version"-macos-10.15.md >> Php-extensions-loaded-on-"$os".md
|
||||
else
|
||||
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
|
||||
fi
|
||||
done
|
||||
done
|
||||
rm -rf ./lists
|
||||
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
|
||||
git add .
|
||||
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"
|
||||
git push -f https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git master || true
|
||||
fi
|
62
.github/workflows/node-release.yml
vendored
Normal file
62
.github/workflows/node-release.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
name: Publish Package
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip:
|
||||
description: Skip release to repository
|
||||
required: false
|
||||
tag:
|
||||
description: Tag name
|
||||
required: true
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@main
|
||||
|
||||
- name: Checkout release
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Checkout tag
|
||||
uses: actions/checkout@v2
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tag }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14.x'
|
||||
registry-url: https://registry.npmjs.org
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Publish to NPM
|
||||
if: "!contains(github.event.inputs.skip, 'skip-npm')"
|
||||
run: npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Change to GitHub Packages registry
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@shivammathur'
|
||||
|
||||
- name: Patch package.json
|
||||
run: |
|
||||
sed -i 's#"name": "#"name": "@shivammathur/#' package.json
|
||||
|
||||
- name: Publish to GitHub Packages
|
||||
if: "!contains(github.event.inputs.skip, 'skip-github-packages')"
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
65
.github/workflows/node-workflow.yml
vendored
Normal file
65
.github/workflows/node-workflow.yml
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
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: Harden Runner
|
||||
if: runner.os == 'Linux'
|
||||
uses: step-security/harden-runner@main
|
||||
with:
|
||||
allowed-endpoints:
|
||||
beta.api.stepsecurity.io.:443
|
||||
codecov.io.:443
|
||||
github.com.:443
|
||||
nodejs.org.:443
|
||||
raw.githubusercontent.com.:443
|
||||
registry.npmjs.org.:443
|
||||
setup-php.com.:443
|
||||
storage.googleapis.com.:443
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js 15.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 15.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/lcov.info -n github-actions-codecov-${{ matrix.operating-system }}
|
98
.github/workflows/workflow.yml
vendored
98
.github/workflows/workflow.yml
vendored
@ -1,46 +1,78 @@
|
||||
name: Main workflow
|
||||
on: [push]
|
||||
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
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
max-parallel: 8
|
||||
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, windows-latest, macos-latest]
|
||||
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
|
||||
env:
|
||||
extensions: xml, opcache, xdebug, pcov
|
||||
key: cache-v5
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set Node.js 10.x
|
||||
uses: actions/setup-node@master
|
||||
with:
|
||||
version: 10.x
|
||||
- name: Setup cache environment
|
||||
id: cache-env
|
||||
uses: shivammathur/cache-extensions@develop
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: ${{ env.extensions }}
|
||||
key: ${{ env.key }}
|
||||
|
||||
- name: Installing NPM
|
||||
run: npm install
|
||||
- name: Cache extensions
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.cache-env.outputs.dir }}
|
||||
key: ${{ steps.cache-env.outputs.key }}
|
||||
restore-keys: ${{ steps.cache-env.outputs.key }}
|
||||
|
||||
- name: Run tests and send coverage
|
||||
run: |
|
||||
npm test
|
||||
curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
|
||||
- name: Setup PHP with extensions and custom config
|
||||
run: node dist/index.js
|
||||
env:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: ${{ env.extensions }}
|
||||
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata
|
||||
|
||||
- name: Installing PHP with extensions and custom config
|
||||
run: node lib/install.js
|
||||
env:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extension-csv: "mbstring, xdebug, pcov" #optional
|
||||
ini-values-csv: "post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata" #optional
|
||||
- name: Testing PHP version
|
||||
run: |
|
||||
php -v
|
||||
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}"
|
||||
|
||||
- name: Testing PHP version
|
||||
run: php -v
|
||||
- name: Testing Composer version
|
||||
run: composer -V
|
||||
- name: Testing Extensions
|
||||
run: php -m
|
||||
- name: Testing ini values
|
||||
run: |
|
||||
php -r "echo \"post_max_size: \" . ini_get('post_max_size') . \"\n\";"
|
||||
php -r "echo \"short_open_tag: \" . ini_get('short_open_tag') . \"\n\";"
|
||||
php -r "echo \"date.timezone: \" . ini_get('date.timezone') . \"\n\";"
|
||||
- name: Testing Composer version
|
||||
run: |
|
||||
composer -V
|
||||
php -r "if(strpos(@exec('composer -V'), 'Composer version') === false) {throw new Exception('Composer not found');}"
|
||||
- name: Testing Extensions
|
||||
run: |
|
||||
php -m
|
||||
php -r "if(! extension_loaded('xml')) {throw new Exception('xml not found');}"
|
||||
php -r "if(! extension_loaded('Xdebug')) {throw new Exception('Xdebug not found');}"
|
||||
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
||||
- name: Testing ini values
|
||||
run: |
|
||||
php -r "if(ini_get('memory_limit')!='-1') {throw new Exception('memory_limit not disabled');}"
|
||||
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
|
||||
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
|
||||
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
|
||||
!node_modules/
|
||||
node_modules/
|
||||
__tests__/runner/*
|
||||
lib/
|
||||
|
||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
# Logs
|
||||
|
@ -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
|
||||
}
|
2
LICENSE
2
LICENSE
@ -1,7 +1,7 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 shivammathur and contributors
|
||||
Copyright (c) 2019-2021 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
|
||||
|
21
__tests__/config.test.ts
Normal file
21
__tests__/config.test.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import * as config from '../src/config';
|
||||
|
||||
describe('Config tests', () => {
|
||||
it.each`
|
||||
ini_values | os_version | output
|
||||
${'a=b, c=d'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=b\nc=d"'}
|
||||
${'a=b, c=d'} | ${'linux'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
|
||||
${'a=b, c=d'} | ${'darwin'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
|
||||
${'a=b & ~c'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=\'b & ~c\'"'}
|
||||
${'a="~(b)"'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=\'~(b)\'"'}
|
||||
${'a="b, c"'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=b, c"'}
|
||||
${'a=b, c=d'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||
`(
|
||||
'checking addINIValues on $os_version',
|
||||
async ({ini_values, os_version, output}) => {
|
||||
expect(await config.addINIValues(ini_values, os_version)).toContain(
|
||||
output
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
39
__tests__/coverage.test.ts
Normal file
39
__tests__/coverage.test.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import * as coverage from '../src/coverage';
|
||||
|
||||
describe('Config tests', () => {
|
||||
it.each`
|
||||
driver | php | os | output
|
||||
${'PCOV'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'}
|
||||
${'pcov'} | ${'7.0'} | ${'win32'} | ${'PHP 7.1 or newer is required'}
|
||||
${'pcov'} | ${'5.6'} | ${'win32'} | ${'PHP 7.1 or newer is required'}
|
||||
${'pcov'} | ${'7.4'} | ${'win32'} | ${'Add-Extension pcov,Disable-Extension xdebug false'}
|
||||
${'pcov'} | ${'7.4'} | ${'linux'} | ${'add_extension pcov,disable_extension xdebug false'}
|
||||
${'pcov'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension pcov,disable_extension xdebug false'}
|
||||
${'xdebug'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug'}
|
||||
${'xdebug3'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug'}
|
||||
${'xdebug2'} | ${'7.4'} | ${'win32'} | ${'Add-Extension xdebug stable 2.9.8'}
|
||||
${'xdebug'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
|
||||
${'xdebug3'} | ${'8.0'} | ${'linux'} | ${'add_extension xdebug'}
|
||||
${'xdebug2'} | ${'7.4'} | ${'linux'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
||||
${'xdebug'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'}
|
||||
${'xdebug3'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug'}
|
||||
${'xdebug2'} | ${'7.4'} | ${'darwin'} | ${'add_brew_extension xdebug2'}
|
||||
${'none'} | ${'7.4'} | ${'win32'} | ${'Disable-Extension xdebug false,Disable-Extension pcov false'}
|
||||
${'none'} | ${'7.4'} | ${'linux'} | ${'disable_extension xdebug false,disable_extension pcov false'}
|
||||
${'none'} | ${'7.4'} | ${'darwin'} | ${'disable_extension xdebug false,disable_extension pcov false'}
|
||||
${'nocov'} | ${'7.x'} | ${'any'} | ${''}
|
||||
${''} | ${'7.x'} | ${'any'} | ${''}
|
||||
`(
|
||||
'checking addCoverage with $driver on $os',
|
||||
async ({driver, php, os, output}) => {
|
||||
const script: string = await coverage.addCoverage(driver, php, os);
|
||||
if (output) {
|
||||
output.split(',').forEach((command: string) => {
|
||||
expect(script).toContain(command);
|
||||
});
|
||||
} else {
|
||||
expect(script).toEqual(output);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
138
__tests__/extensions.test.ts
Normal file
138
__tests__/extensions.test.ts
Normal file
@ -0,0 +1,138 @@
|
||||
import * as fs from 'fs';
|
||||
import * as extensions from '../src/extensions';
|
||||
|
||||
describe('Extension tests', () => {
|
||||
it.each`
|
||||
extension | version | output
|
||||
${'none'} | ${'7.4'} | ${'Disable-AllShared'}
|
||||
${':intl'} | ${'7.4'} | ${'Disable-Extension intl'}
|
||||
${'ast-beta'} | ${'7.4'} | ${'Add-Extension ast beta'}
|
||||
${'blackfire'} | ${'7.3'} | ${'Add-Blackfire blackfire'}
|
||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'Add-Blackfire blackfire-1.31.0'}
|
||||
${'grpc-1.2.3'} | ${'7.4'} | ${'Add-Extension grpc stable 1.2.3'}
|
||||
${'inotify-1.2.3alpha2'} | ${'7.4'} | ${'Add-Extension inotify alpha 1.2.3'}
|
||||
${'ioncube'} | ${'7.4'} | ${'Add-Ioncube'}
|
||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'Add-Log "$cross" "mongodb-mongodb/mongo-php-driver@master" "mongodb-mongodb/mongo-php-driver@master is not supported on PHP 7.3"'}
|
||||
${'mysql'} | ${'7.4'} | ${'Add-Extension mysqli\nAdd-Extension mysqlnd'}
|
||||
${'mysql'} | ${'5.5'} | ${'Add-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd'}
|
||||
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
|
||||
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
||||
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
|
||||
${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
|
||||
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
|
||||
${'phalcon4'} | ${'7.4'} | ${'Add-Phalcon phalcon4'}
|
||||
${'sqlite'} | ${'7.4'} | ${'Add-Extension sqlite3'}
|
||||
${'sqlsrv-1.2.3preview1'} | ${'7.4'} | ${'Add-Extension sqlsrv devel 1.2.3'}
|
||||
${'Xdebug'} | ${'7.4'} | ${'Add-Extension xdebug'}
|
||||
${'xdebug2'} | ${'7.2'} | ${'Add-Extension xdebug stable 2.9.8'}
|
||||
`(
|
||||
'checking addExtensionOnWindows for extension $extension on version $version',
|
||||
async ({extension, version, output}) => {
|
||||
expect(
|
||||
await extensions.addExtension(extension, version, 'win32')
|
||||
).toContain(output);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
extension | version | output
|
||||
${'none'} | ${'7.4'} | ${'disable_all_shared'}
|
||||
${':intl'} | ${'7.4'} | ${'disable_extension intl'}
|
||||
${'ast-beta'} | ${'7.4'} | ${'add_unstable_extension ast beta extension'}
|
||||
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
||||
${'couchbase'} | ${'7.4'} | ${'add_couchbase'}
|
||||
${'gearman'} | ${'5.6'} | ${'add_gearman'}
|
||||
${'geos'} | ${'7.3'} | ${'add_geos'}
|
||||
${'grpc-1.2.3'} | ${'7.4'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
||||
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
||||
${'intl-65.1'} | ${'5.6'} | ${'add_intl intl-65.1'}
|
||||
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
||||
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
||||
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
|
||||
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
|
||||
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
|
||||
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
|
||||
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
|
||||
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
||||
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
||||
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}
|
||||
${'sqlite'} | ${'7.4'} | ${'add_extension sqlite3'}
|
||||
${'Xdebug'} | ${'7.4'} | ${'add_extension xdebug'}
|
||||
${'xdebug-alpha'} | ${'7.4'} | ${'add_unstable_extension xdebug alpha zend_extension'}
|
||||
${'xdebug2'} | ${'7.2'} | ${'add_pecl_extension xdebug 2.9.8 zend_extension'}
|
||||
`(
|
||||
'checking addExtensionOnLinux for extension $extension on version $version',
|
||||
async ({extension, version, output}) => {
|
||||
expect(
|
||||
await extensions.addExtension(extension, version, 'linux')
|
||||
).toContain(output);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
extension | version | output
|
||||
${'none'} | ${'7.2'} | ${'disable_all_shared'}
|
||||
${':intl'} | ${'7.2'} | ${'disable_extension intl'}
|
||||
${'ast-beta'} | ${'7.2'} | ${'add_unstable_extension ast beta extension'}
|
||||
${'blackfire'} | ${'7.3'} | ${'add_blackfire blackfire'}
|
||||
${'blackfire-1.31.0'} | ${'7.3'} | ${'add_blackfire blackfire-1.31.0'}
|
||||
${'couchbase'} | ${'5.6'} | ${'add_couchbase'}
|
||||
${'does_not_exist'} | ${'7.2'} | ${'add_extension does_not_exist'}
|
||||
${'geos'} | ${'7.3'} | ${'add_geos'}
|
||||
${'grpc-1.2.3'} | ${'7.2'} | ${'add_pecl_extension grpc 1.2.3 extension'}
|
||||
${'http-1.2.3'} | ${'7.3'} | ${'add_http http-1.2.3'}
|
||||
${'imagick'} | ${'5.5'} | ${'add_extension imagick'}
|
||||
${'ioncube'} | ${'7.3'} | ${'add_ioncube'}
|
||||
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.2'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
|
||||
${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
|
||||
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
|
||||
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
||||
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
||||
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
|
||||
`(
|
||||
'checking addExtensionOnDarwin for extension $extension on version $version',
|
||||
async ({extension, version, output}) => {
|
||||
expect(
|
||||
await extensions.addExtension(extension, version, 'darwin')
|
||||
).toContain(output);
|
||||
}
|
||||
);
|
||||
|
||||
const data: string[][] = fs
|
||||
.readFileSync('src/configs/brew_extensions')
|
||||
.toString()
|
||||
.split(/\r?\n/)
|
||||
.filter(Boolean)
|
||||
.map(line => {
|
||||
const [formula, extension]: string[] = line.split('=');
|
||||
const prefix: string =
|
||||
extension == 'xdebug' ? 'zend_extension' : 'extension';
|
||||
const output: string = fs.existsSync(`src/scripts/ext/${extension}.sh`)
|
||||
? `add_${extension}`
|
||||
: `add_brew_extension ${formula} ${prefix}`;
|
||||
return [formula, '7.3', output];
|
||||
});
|
||||
|
||||
it.each(data)(
|
||||
'checking addExtensionOnDarwin for brew extension %s',
|
||||
async (extension, version, output) => {
|
||||
expect(
|
||||
await extensions.addExtension(extension, version, 'darwin')
|
||||
).toContain(output);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
extension | version | output
|
||||
${'xdebug'} | ${'7.2'} | ${'Platform openbsd is not supported'}
|
||||
`(
|
||||
'checking addExtension on openbsd for extension $extension on version $version',
|
||||
async ({extension, version, output}) => {
|
||||
expect(
|
||||
await extensions.addExtension(extension, version, 'openbsd')
|
||||
).toContain(output);
|
||||
}
|
||||
);
|
||||
});
|
@ -1,211 +0,0 @@
|
||||
import * as features from '../src/features';
|
||||
|
||||
let valid_extensions = ['xdebug', 'pcov'];
|
||||
jest.mock('../src/pecl', () => ({
|
||||
checkPECLExtension: jest.fn().mockImplementation(extension => {
|
||||
return valid_extensions.indexOf(extension) !== -1;
|
||||
})
|
||||
}));
|
||||
|
||||
describe('Features tests', () => {
|
||||
it('checking addExtensionOnWindows', async () => {
|
||||
let win32: string = await features.addExtension(
|
||||
'xdebug, pcov',
|
||||
'7.2',
|
||||
'win32'
|
||||
);
|
||||
expect(win32).toContain('Install-PhpExtension xdebug');
|
||||
expect(win32).toContain('Install-PhpExtension pcov');
|
||||
win32 = await features.addExtension('xdebug, pcov', '7.4', 'win32');
|
||||
const extension_url: string =
|
||||
'https://xdebug.org/files/php_xdebug-2.8.0beta2-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');
|
||||
|
||||
win32 = await features.addExtension('does_not_exist', '7.2', 'win32');
|
||||
expect(win32).toContain('Could not find does_not_exist for PHP7.2 on PECL');
|
||||
|
||||
win32 = await features.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(win32).toContain('Platform fedora is not supported');
|
||||
});
|
||||
|
||||
it('checking addExtensionOnLinux', async () => {
|
||||
let linux: string = await features.addExtension(
|
||||
'xdebug, pcov',
|
||||
'7.2',
|
||||
'linux'
|
||||
);
|
||||
expect(linux).toContain(
|
||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-xdebug'
|
||||
);
|
||||
expect(linux).toContain(
|
||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php7.2-pcov'
|
||||
);
|
||||
|
||||
linux = await features.addExtension('xdebug, pcov', '7.4', 'linux');
|
||||
expect(linux).toContain('./xdebug.sh');
|
||||
expect(linux).toContain('./pcov.sh');
|
||||
|
||||
linux = await features.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(linux).toContain('Platform fedora is not supported');
|
||||
});
|
||||
|
||||
it('checking addExtensionOnDarwin', async () => {
|
||||
let darwin: string = await features.addExtension(
|
||||
'xdebug, pcov',
|
||||
'7.2',
|
||||
'darwin'
|
||||
);
|
||||
expect(darwin).toContain('sudo pecl install xdebug');
|
||||
expect(darwin).toContain('sudo pecl install pcov');
|
||||
|
||||
darwin = await features.addExtension('pcov', '5.6', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install pcov');
|
||||
|
||||
darwin = await features.addExtension('pcov', '7.2', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install pcov');
|
||||
|
||||
darwin = await features.addExtension('xdebug', '5.6', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
|
||||
|
||||
darwin = await features.addExtension('xdebug', '7.4', 'darwin');
|
||||
expect(darwin).toContain('sh ./xdebug_darwin.sh');
|
||||
|
||||
darwin = await features.addExtension('pcov', '7.4', 'darwin');
|
||||
expect(darwin).toContain('sh ./pcov.sh');
|
||||
|
||||
darwin = await features.addExtension('xdebug', '7.2', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install xdebug');
|
||||
|
||||
darwin = await features.addExtension('does_not_exist', '7.2', 'darwin');
|
||||
expect(darwin).toContain(
|
||||
'Could not find does_not_exist for PHP7.2 on PECL'
|
||||
);
|
||||
|
||||
darwin = await features.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(darwin).toContain('Platform fedora is not supported');
|
||||
});
|
||||
|
||||
it('checking addINIValuesOnWindows', async () => {
|
||||
let win32: string = await features.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'win32'
|
||||
);
|
||||
expect(win32).toContain(
|
||||
'Add-Content C:\\tools\\php\\php.ini "post_max_size=256M"'
|
||||
);
|
||||
expect(win32).toContain(
|
||||
'Add-Content C:\\tools\\php\\php.ini "short_open_tag=On"'
|
||||
);
|
||||
expect(win32).toContain(
|
||||
'Add-Content C:\\tools\\php\\php.ini "date.timezone=Asia/Kolkata"'
|
||||
);
|
||||
|
||||
win32 = await features.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'fedora'
|
||||
);
|
||||
expect(win32).toContain('Platform fedora is not supported');
|
||||
});
|
||||
|
||||
it('checking addINIValuesOnLinux', async () => {
|
||||
let linux: string = await features.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'linux'
|
||||
);
|
||||
expect(linux).toContain('echo "post_max_size=256M" >> $ini_file');
|
||||
expect(linux).toContain('echo "short_open_tag=On" >> $ini_file');
|
||||
expect(linux).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
|
||||
|
||||
linux = await features.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'fedora'
|
||||
);
|
||||
expect(linux).toContain('Platform fedora is not supported');
|
||||
});
|
||||
|
||||
it('checking addINIValuesOnDarwin', async () => {
|
||||
let darwin: string = await features.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'darwin'
|
||||
);
|
||||
expect(darwin).toContain('echo "post_max_size=256M" >> $ini_file');
|
||||
expect(darwin).toContain('echo "short_open_tag=On" >> $ini_file');
|
||||
expect(darwin).toContain('echo "date.timezone=Asia/Kolkata" >> $ini_file');
|
||||
|
||||
darwin = await features.addINIValues(
|
||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
||||
'fedora'
|
||||
);
|
||||
expect(darwin).toContain('Platform fedora is not supported');
|
||||
});
|
||||
|
||||
it('checking addCoverage on windows', async () => {
|
||||
let win32: string = await features.addCoverage('xdebug', '7.4', 'win32');
|
||||
const extension_url: string =
|
||||
'https://xdebug.org/files/php_xdebug-2.8.0beta2-7.4-vc15.dll';
|
||||
expect(win32).toContain(
|
||||
'Invoke-WebRequest -Uri ' +
|
||||
extension_url +
|
||||
' -OutFile C:\\tools\\php\\ext\\php_xdebug.dll'
|
||||
);
|
||||
|
||||
win32 = await features.addCoverage('xdebug', '7.3', 'win32');
|
||||
expect(win32).toContain('Install-PhpExtension xdebug');
|
||||
|
||||
win32 = await features.addCoverage('pcov', '7.4', 'win32');
|
||||
expect(win32).toContain('Install-PhpExtension pcov');
|
||||
expect(win32).toContain(
|
||||
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php'
|
||||
);
|
||||
|
||||
win32 = await features.addCoverage('pcov', '7.3', 'win32');
|
||||
expect(win32).toContain('Install-PhpExtension pcov');
|
||||
expect(win32).toContain(
|
||||
'if(php -m | findstr -i xdebug) { Disable-PhpExtension xdebug C:\\tools\\php'
|
||||
);
|
||||
|
||||
win32 = await features.addCoverage('nocov', '7.3', 'win32');
|
||||
expect(win32).toContain('');
|
||||
|
||||
win32 = await features.addCoverage('pcov', '7.0', 'win32');
|
||||
expect(win32).toContain('PCOV requires PHP 7.1 or newer');
|
||||
|
||||
win32 = await features.addCoverage('pcov', '5.6', 'win32');
|
||||
expect(win32).toContain('PCOV requires PHP 7.1 or newer');
|
||||
|
||||
win32 = await features.addCoverage('', '7.4', 'win32');
|
||||
expect(win32).toEqual('');
|
||||
});
|
||||
|
||||
it('checking addCoverage on linux', async () => {
|
||||
let linux: string = await features.addCoverage('xdebug', '7.4', 'linux');
|
||||
expect(linux).toContain('./xdebug.sh');
|
||||
|
||||
linux = await features.addCoverage('pcov', '7.4', 'linux');
|
||||
expect(linux).toContain('./pcov.sh');
|
||||
expect(linux).toContain('sudo sed -i "/xdebug/d" $ini_file');
|
||||
expect(linux).toContain('sudo phpdismod xdebug');
|
||||
|
||||
linux = await features.addCoverage('', '7.4', 'linux');
|
||||
expect(linux).toEqual('');
|
||||
});
|
||||
|
||||
it('checking addCoverage on darwin', async () => {
|
||||
let darwin: string = await features.addCoverage('xdebug', '7.4', 'darwin');
|
||||
expect(darwin).toContain('sh ./xdebug_darwin.sh');
|
||||
|
||||
darwin = await features.addCoverage('xdebug', '5.6', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
|
||||
|
||||
darwin = await features.addCoverage('pcov', '7.4', 'darwin');
|
||||
expect(darwin).toContain('sh ./pcov.sh');
|
||||
|
||||
darwin = await features.addCoverage('', '7.4', 'win32');
|
||||
expect(darwin).toEqual('');
|
||||
});
|
||||
});
|
101
__tests__/install.test.ts
Normal file
101
__tests__/install.test.ts
Normal file
@ -0,0 +1,101 @@
|
||||
import * as install from '../src/install';
|
||||
import * as utils from '../src/utils';
|
||||
|
||||
/**
|
||||
* Mock install.ts
|
||||
*/
|
||||
jest.mock('../src/install', () => ({
|
||||
getScript: jest.fn().mockImplementation(async (): Promise<string> => {
|
||||
const extension_csv: string = process.env['extensions'] || '';
|
||||
const ini_values_csv: string = process.env['ini-values'] || '';
|
||||
const coverage_driver: string = process.env['coverage'] || '';
|
||||
const tools_csv: string = process.env['tools'] || '';
|
||||
let script = 'initial script';
|
||||
script += tools_csv ? ' add_tool' : '';
|
||||
script += extension_csv ? ' install extensions' : '';
|
||||
script += coverage_driver ? ' set coverage driver' : '';
|
||||
script += ini_values_csv ? ' edit php.ini' : '';
|
||||
return script;
|
||||
}),
|
||||
run: jest.fn().mockImplementation(async (): Promise<string> => {
|
||||
const os_version: string = process.env['RUNNER_OS'] || '';
|
||||
const version: string = await utils.parseVersion(
|
||||
await utils.getInput('php-version', true)
|
||||
);
|
||||
const tool = await utils.scriptTool(os_version);
|
||||
const filename = os_version + (await utils.scriptExtension(os_version));
|
||||
return [
|
||||
await install.getScript(filename, version, os_version),
|
||||
tool,
|
||||
filename,
|
||||
version,
|
||||
__dirname
|
||||
].join(' ');
|
||||
})
|
||||
}));
|
||||
|
||||
/**
|
||||
* Function to set the process.env
|
||||
*
|
||||
* @param version
|
||||
* @param os
|
||||
* @param extension_csv
|
||||
* @param ini_values_csv
|
||||
* @param coverage_driver
|
||||
* @param tools
|
||||
*/
|
||||
function setEnv(
|
||||
version: string | number,
|
||||
os: string,
|
||||
extension_csv: string,
|
||||
ini_values_csv: string,
|
||||
coverage_driver: string,
|
||||
tools: string
|
||||
): void {
|
||||
process.env['php-version'] = version.toString();
|
||||
process.env['RUNNER_OS'] = os;
|
||||
process.env['extensions'] = extension_csv;
|
||||
process.env['ini-values'] = ini_values_csv;
|
||||
process.env['coverage'] = coverage_driver;
|
||||
process.env['tools'] = tools;
|
||||
}
|
||||
|
||||
describe('Install', () => {
|
||||
it.each`
|
||||
version | os | extension_csv | ini_values_csv | coverage_driver | tools | output
|
||||
${'7.3'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 7.3 ' + __dirname}
|
||||
${'7.3'} | ${'darwin'} | ${'a, b'} | ${'a=b'} | ${'x'} | ${''} | ${'initial script install extensions set coverage driver edit php.ini bash darwin.sh 7.3 ' + __dirname}
|
||||
${'7.4.1'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 7.4 ' + __dirname}
|
||||
${'8'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 8.0 ' + __dirname}
|
||||
${'8.0'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 8.0 ' + __dirname}
|
||||
${'8.1'} | ${'darwin'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash darwin.sh 8.1 ' + __dirname}
|
||||
${'7.3'} | ${'linux'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash linux.sh 7.3 ' + __dirname}
|
||||
${'7.3'} | ${'linux'} | ${'a, b'} | ${'a=b'} | ${'x'} | ${'phpunit'} | ${'initial script add_tool install extensions set coverage driver edit php.ini bash linux.sh 7.3 ' + __dirname}
|
||||
${'latest'} | ${'linux'} | ${''} | ${''} | ${''} | ${''} | ${'initial script bash linux.sh 8.1 ' + __dirname}
|
||||
${'7.0'} | ${'win32'} | ${''} | ${''} | ${''} | ${''} | ${'initial script pwsh win32.ps1 7.0 ' + __dirname}
|
||||
${'7.3'} | ${'win32'} | ${''} | ${''} | ${''} | ${''} | ${'initial script pwsh win32.ps1 7.3 ' + __dirname}
|
||||
${'7.3'} | ${'win32'} | ${'a, b'} | ${'a=b'} | ${'x'} | ${''} | ${'initial script install extensions set coverage driver edit php.ini pwsh win32.ps1 7.3 ' + __dirname}
|
||||
`(
|
||||
'Test install on $os for $version with extensions=$extension_csv, ini_values=$ini_values_csv, coverage_driver=$coverage_driver, tools=$tools',
|
||||
async ({
|
||||
version,
|
||||
os,
|
||||
extension_csv,
|
||||
ini_values_csv,
|
||||
coverage_driver,
|
||||
tools,
|
||||
output
|
||||
}) => {
|
||||
setEnv(
|
||||
version,
|
||||
os,
|
||||
extension_csv,
|
||||
ini_values_csv,
|
||||
coverage_driver,
|
||||
tools
|
||||
);
|
||||
|
||||
expect(await install.run()).toBe(output);
|
||||
}
|
||||
);
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
import * as pecl from '../src/pecl';
|
||||
|
||||
let valid_extensions = ['xdebug', 'pcov'];
|
||||
jest.mock('../src/pecl', () => ({
|
||||
checkPECLExtension: jest.fn().mockImplementation(extension => {
|
||||
return valid_extensions.indexOf(extension) !== -1;
|
||||
})
|
||||
}));
|
||||
|
||||
describe('pecl tests', () => {
|
||||
it('checking checkPECLExtension', async () => {
|
||||
expect(await pecl.checkPECLExtension('extensionDoesNotExist')).toBe(false);
|
||||
expect(await pecl.checkPECLExtension('xdebug')).toBe(true);
|
||||
});
|
||||
});
|
529
__tests__/tools.test.ts
Normal file
529
__tests__/tools.test.ts
Normal file
@ -0,0 +1,529 @@
|
||||
import * as tools from '../src/tools';
|
||||
import * as utils from '../src/utils';
|
||||
|
||||
interface IData {
|
||||
tool: string;
|
||||
version?: string;
|
||||
domain?: string;
|
||||
extension?: string;
|
||||
os_version?: string;
|
||||
php_version?: string;
|
||||
release?: string;
|
||||
repository?: string;
|
||||
type?: string;
|
||||
fetch_latest?: string;
|
||||
version_parameter?: string;
|
||||
version_prefix?: string;
|
||||
}
|
||||
|
||||
function getData(data: IData): Record<string, string> {
|
||||
return {
|
||||
tool: data.tool,
|
||||
version: data.version || '',
|
||||
domain: data.domain || 'https://example.com',
|
||||
extension: data.extension || '.phar',
|
||||
os_version: data.os_version || 'linux',
|
||||
php_version: data.php_version || '7.4',
|
||||
release: data.release || [data.tool, data.version].join(':'),
|
||||
repository: data.repository || '',
|
||||
type: data.type || 'phar',
|
||||
fetch_latest: data.fetch_latest || 'false',
|
||||
version_parameter: data.version_parameter || '-V',
|
||||
version_prefix: data.version_prefix || '',
|
||||
github: 'https://github.com',
|
||||
prefix: 'releases',
|
||||
verb: 'download'
|
||||
};
|
||||
}
|
||||
|
||||
jest
|
||||
.spyOn(utils, 'fetch')
|
||||
.mockImplementation(
|
||||
async (url: string, token?: string): Promise<Record<string, string>> => {
|
||||
if (url.includes('atom') && !url.includes('no-release')) {
|
||||
return {
|
||||
data: '"releases/tag/1.2.3", "releases/tag/3.2.1", "releases/tag/2.3.1"'
|
||||
};
|
||||
} else if (url.includes('no-release')) {
|
||||
return {data: ''};
|
||||
} else if (!token || token === 'valid_token') {
|
||||
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
|
||||
} else if (token === 'beta_token') {
|
||||
return {data: `[{"ref": "refs/tags/1.2.3-beta1", "url": "${url}"}]`};
|
||||
} else if (token === 'no_data') {
|
||||
return {data: '[]'};
|
||||
} else {
|
||||
return {error: 'Invalid token'};
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
describe('Tools tests', () => {
|
||||
it.each`
|
||||
token | version
|
||||
${'invalid_token'} | ${'1.2'}
|
||||
${'valid_token'} | ${'1.2.3'}
|
||||
${'beta_token'} | ${'1.2.3-beta1'}
|
||||
${''} | ${'1.2.3'}
|
||||
`('checking getSemverVersion: $token', async ({token, version}) => {
|
||||
process.env['COMPOSER_TOKEN'] = token;
|
||||
expect(
|
||||
await tools.getSemverVersion(getData({tool: 'tool', version: '1.2'}))
|
||||
).toBe(version);
|
||||
});
|
||||
|
||||
it.each`
|
||||
tool | fetch_latest | version
|
||||
${'tool'} | ${'true'} | ${'3.2.1'}
|
||||
${'tool-no-release'} | ${'true'} | ${'latest'}
|
||||
${'tool'} | ${'false'} | ${'latest'}
|
||||
`(
|
||||
'checking getLatestVersion: $tool, $fetch_latest, $version',
|
||||
async ({tool, fetch_latest, version}) => {
|
||||
expect(
|
||||
await tools.getLatestVersion(
|
||||
getData({
|
||||
tool: tool,
|
||||
repository: 'user/' + tool,
|
||||
fetch_latest: fetch_latest
|
||||
})
|
||||
)
|
||||
).toBe(version);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
version | tool | type | expected
|
||||
${'latest'} | ${'tool'} | ${'phar'} | ${'latest'}
|
||||
${'1'} | ${'composer'} | ${'phar'} | ${'1'}
|
||||
${'1.2'} | ${'tool'} | ${'composer'} | ${'1.2.*'}
|
||||
${'^1.2.3'} | ${'tool'} | ${'phar'} | ${'1.2.3'}
|
||||
${'>=1.2.3'} | ${'tool'} | ${'phar'} | ${'1.2.3'}
|
||||
${'>1.2.3'} | ${'tool'} | ${'phar'} | ${'1.2.3'}
|
||||
${'1.2.3-ALPHA'} | ${'tool'} | ${'phar'} | ${'1.2.3-ALPHA'}
|
||||
${'1.2.3-alpha'} | ${'tool'} | ${'phar'} | ${'1.2.3-alpha'}
|
||||
${'1.2.3-beta'} | ${'tool'} | ${'phar'} | ${'1.2.3-beta'}
|
||||
${'1.2.3-rc'} | ${'tool'} | ${'phar'} | ${'1.2.3-rc'}
|
||||
${'1.2.3-dev'} | ${'tool'} | ${'phar'} | ${'1.2.3-dev'}
|
||||
${'1.2.3-alpha1'} | ${'tool'} | ${'phar'} | ${'1.2.3-alpha1'}
|
||||
${'1.2.3-alpha.1'} | ${'tool'} | ${'phar'} | ${'1.2.3-alpha.1'}
|
||||
`(
|
||||
'checking getVersion: $version, $tool, $type',
|
||||
async ({version, tool, type, expected}) => {
|
||||
expect(
|
||||
await tools.getVersion(
|
||||
version,
|
||||
getData({tool: tool, version: version, type: type})
|
||||
)
|
||||
).toBe(expected);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
input | expected
|
||||
${'tool'} | ${'tool'}
|
||||
${'alias:1.2.3'} | ${'tool:1.2.3'}
|
||||
${'tool:1.2.3'} | ${'tool:1.2.3'}
|
||||
${'tool:^1.2.3'} | ${'tool:^1.2.3'}
|
||||
${'tool:>=1.2.3'} | ${'tool:>=1.2.3'}
|
||||
${'tool:>1.2.3'} | ${'tool:>1.2.3'}
|
||||
${'tool:1.2.3-ALPHA'} | ${'tool:1.2.3-ALPHA'}
|
||||
${'tool:1.2.3-beta'} | ${'tool:1.2.3-beta'}
|
||||
${'tool:1.2.3-rc'} | ${'tool:1.2.3-rc'}
|
||||
${'tool:1.2.3-dev'} | ${'tool:1.2.3-dev'}
|
||||
${'tool:1.2.3-alpha1'} | ${'tool:1.2.3-alpha1'}
|
||||
${'tool:1.2.3-alpha.1'} | ${'tool:1.2.3-alpha.1'}
|
||||
${'user/tool:^1.2.3'} | ${'tool:^1.2.3'}
|
||||
`('checking getRelease: $input', async ({input, expected}) => {
|
||||
expect(
|
||||
await tools.getRelease(input, getData({tool: 'tool', version: 'latest'}))
|
||||
).toBe(expected);
|
||||
});
|
||||
|
||||
it.each`
|
||||
input_list | filtered_list
|
||||
${'a, b'} | ${'composer, a, b'}
|
||||
${'a, b, composer'} | ${'composer, a, b'}
|
||||
${'a, b, composer:1.2.3'} | ${'composer:1.2.3, a, b'}
|
||||
${'a, b, composer:v1.2.3'} | ${'composer:1.2.3, a, b'}
|
||||
${'a, b, composer:snapshot'} | ${'composer:snapshot, a, b'}
|
||||
${'a, b, composer:preview'} | ${'composer:preview, a, b'}
|
||||
${'a, b, composer:1'} | ${'composer:1, a, b'}
|
||||
${'a, b, composer:2'} | ${'composer:2, a, b'}
|
||||
${'a, b, composer:v1'} | ${'composer:1, a, b'}
|
||||
${'a, b, composer:v2'} | ${'composer:2, a, b'}
|
||||
`('checking filterList $input_list', async ({input_list, filtered_list}) => {
|
||||
expect(await tools.filterList(input_list.split(', '))).toStrictEqual(
|
||||
filtered_list.split(', ')
|
||||
);
|
||||
});
|
||||
|
||||
it.each`
|
||||
version | version_prefix | url_suffix
|
||||
${'latest'} | ${'v'} | ${'latest/download/tool.phar'}
|
||||
${'1.2.3'} | ${'v'} | ${'download/v1.2.3/tool.phar'}
|
||||
${'1.2.3'} | ${''} | ${'download/1.2.3/tool.phar'}
|
||||
`(
|
||||
'checking getUrl: $version_prefix$version',
|
||||
async ({version, version_prefix, url_suffix}) => {
|
||||
const data = getData({
|
||||
tool: 'tool',
|
||||
version: version,
|
||||
version_prefix: version_prefix
|
||||
});
|
||||
expect(await tools.getUrl(data)).toContain(url_suffix);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
version | version_prefix | url
|
||||
${'latest'} | ${''} | ${'https://example.com/tool.phar'}
|
||||
${'1.2.3'} | ${'v'} | ${'https://example.com/tool-v1.2.3.phar'}
|
||||
`(
|
||||
'checking getPharUrl: $version_prefix$version',
|
||||
async ({version, version_prefix, url}) => {
|
||||
const data = getData({
|
||||
tool: 'tool',
|
||||
version: version,
|
||||
version_prefix: version_prefix
|
||||
});
|
||||
expect(await tools.getPharUrl(data)).toBe(url);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
os_version | script
|
||||
${'linux'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
|
||||
${'darwin'} | ${'add_tool https://example.com/tool.phar tool "-v"'}
|
||||
${'win32'} | ${'Add-Tool https://example.com/tool.phar tool "-v"'}
|
||||
${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||
`('checking addArchive: $os_version', async ({os_version, script}) => {
|
||||
const data = getData({
|
||||
tool: 'tool',
|
||||
version: 'latest',
|
||||
version_parameter: JSON.stringify('-v'),
|
||||
os_version: os_version
|
||||
});
|
||||
data['url'] = 'https://example.com/tool.phar';
|
||||
expect(await tools.addArchive(data)).toContain(script);
|
||||
});
|
||||
|
||||
it.each`
|
||||
os_version | script
|
||||
${'linux'} | ${'add_composertool tool tool:1.2.3 user/'}
|
||||
${'darwin'} | ${'add_composertool tool tool:1.2.3 user/'}
|
||||
${'win32'} | ${'Add-Composertool tool tool:1.2.3 user/'}
|
||||
${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||
`('checking addPackage: $os_version', async ({os_version, script}) => {
|
||||
const data = getData({
|
||||
tool: 'tool',
|
||||
version: '1.2.3',
|
||||
repository: 'user/tool',
|
||||
os_version: os_version
|
||||
});
|
||||
data['release'] = [data['tool'], data['version']].join(':');
|
||||
expect(await tools.addPackage(data)).toContain(script);
|
||||
});
|
||||
|
||||
it.each`
|
||||
version | php_version | os_version | script
|
||||
${'latest'} | ${'7.4'} | ${'linux'} | ${'add_tool https://phar.io/releases/phive.phar phive'}
|
||||
${'1.2.3'} | ${'7.4'} | ${'darwin'} | ${'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'}
|
||||
${'1.2.3'} | ${'7.2'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'}
|
||||
${'1.2.3'} | ${'7.1'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'}
|
||||
${'latest'} | ${'5.6'} | ${'win32'} | ${'Add-Tool https://github.com/phar-io/phive/releases/download/0.12.1/phive-0.12.1.phar phive'}
|
||||
${'latest'} | ${'5.5'} | ${'win32'} | ${'Phive is not supported on PHP 5.5'}
|
||||
`(
|
||||
'checking addPhive: $version, $php_version, $os_version',
|
||||
async ({version, php_version, os_version, script}) => {
|
||||
const data = getData({
|
||||
tool: 'phive',
|
||||
domain: 'https://phar.io',
|
||||
repository: 'phar-io/phive',
|
||||
version_parameter: 'status',
|
||||
version: version,
|
||||
php_version: php_version,
|
||||
os_version: os_version
|
||||
});
|
||||
script = await tools.addPhive(data);
|
||||
expect(script).toContain(script);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
version | php_version | url
|
||||
${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player.phar'}
|
||||
${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'}
|
||||
${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
|
||||
${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'}
|
||||
`(
|
||||
'checking addBlackfirePlayer: $version, $php_version',
|
||||
async ({version, php_version, url}) => {
|
||||
const data = getData({
|
||||
tool: 'blackfire-player',
|
||||
domain: 'https://get.blackfire.io',
|
||||
version_prefix: 'v',
|
||||
version: version,
|
||||
php_version: php_version
|
||||
});
|
||||
expect(await tools.addBlackfirePlayer(data)).toContain(url);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
version | url
|
||||
${'latest'} | ${'https://deployer.org/deployer.phar'}
|
||||
${'1.2.3'} | ${'https://deployer.org/releases/v1.2.3/deployer.phar'}
|
||||
`('checking addDeployer: $version', async ({version, url}) => {
|
||||
const data = getData({
|
||||
tool: 'deployer',
|
||||
domain: 'https://deployer.org',
|
||||
version: version
|
||||
});
|
||||
expect(await tools.addDeployer(data)).toContain(url);
|
||||
});
|
||||
|
||||
it.each`
|
||||
version | no_tool_cache | cache_url | source_url
|
||||
${'latest'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
||||
${'stable'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
||||
${'snapshot'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
|
||||
${'preview'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
|
||||
${'1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
||||
${'2'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
|
||||
${'1.2.3'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
|
||||
${'1.2.3-RC1'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
|
||||
`(
|
||||
'checking addComposer: $version, $no_tool_cache',
|
||||
async ({version, no_tool_cache, cache_url, source_url}) => {
|
||||
const data = getData({
|
||||
tool: 'composer',
|
||||
domain: 'https://getcomposer.org',
|
||||
repository: 'composer/composer',
|
||||
version: version
|
||||
});
|
||||
process.env['no_tools_cache'] = no_tool_cache;
|
||||
if (no_tool_cache !== 'true') {
|
||||
expect(await tools.addComposer(data)).toContain(
|
||||
`${cache_url},${source_url}`
|
||||
);
|
||||
} else {
|
||||
expect(await tools.addComposer(data)).toContain(source_url);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
version | os_version | uri
|
||||
${'latest'} | ${'linux'} | ${'releases/latest/download/symfony_linux_amd64'}
|
||||
${'1.2.3'} | ${'linux'} | ${'releases/download/v1.2.3/symfony_linux_amd64'}
|
||||
${'latest'} | ${'darwin'} | ${'releases/latest/download/symfony_darwin_amd64'}
|
||||
${'1.2.3'} | ${'darwin'} | ${'releases/download/v1.2.3/symfony_darwin_amd64'}
|
||||
${'latest'} | ${'win32'} | ${'releases/latest/download/symfony_windows_amd64.exe'}
|
||||
${'1.2.3'} | ${'win32'} | ${'releases/download/v1.2.3/symfony_windows_amd64.exe'}
|
||||
${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||
`(
|
||||
'checking addSymfony: $version, $os_version',
|
||||
async ({version, os_version, uri}) => {
|
||||
const data = getData({
|
||||
tool: 'symfony',
|
||||
php_version: '7.4',
|
||||
version: version,
|
||||
os_version: os_version
|
||||
});
|
||||
expect(await tools.addSymfony(data)).toContain(uri);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
version | uri
|
||||
${'latest'} | ${'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'}
|
||||
${'1.2.3'} | ${'wp-cli/wp-cli/releases/download/v1.2.3/wp-cli-1.2.3.phar'}
|
||||
`('checking addWPCLI: $version', async ({version, uri}) => {
|
||||
const data = getData({
|
||||
tool: 'wp-cli',
|
||||
repository: 'wp-cli/wp-cli',
|
||||
php_version: '7.4',
|
||||
version_prefix: 'v',
|
||||
version: version
|
||||
});
|
||||
expect(await tools.addWPCLI(data)).toContain(uri);
|
||||
});
|
||||
|
||||
it.each`
|
||||
tool | os_version | script
|
||||
${'phpize'} | ${'linux'} | ${'add_devtools phpize'}
|
||||
${'php-config'} | ${'linux'} | ${'add_devtools php-config'}
|
||||
${'phpize'} | ${'darwin'} | ${'add_devtools phpize'}
|
||||
${'php-config'} | ${'darwin'} | ${'add_devtools php-config'}
|
||||
${'phpize'} | ${'win32'} | ${'Add-Log "$tick" "phpize" "phpize is not a windows tool"'}
|
||||
${'php-config'} | ${'win32'} | ${'Add-Log "$tick" "php-config" "php-config is not a windows tool"'}
|
||||
${'phpize'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||
`(
|
||||
'checking addDevTools: $tool, $os_version',
|
||||
async ({tool, os_version, script}) => {
|
||||
const data = getData({
|
||||
version: '7.4',
|
||||
tool: tool,
|
||||
os_version: os_version
|
||||
});
|
||||
expect(await tools.addDevTools(data)).toContain(script);
|
||||
}
|
||||
);
|
||||
|
||||
it.each([
|
||||
[
|
||||
'blackfire, blackfire-player, cs2pr, flex, grpc_php_plugin, parallel-lint, php-cs-fixer, phpDocumentor, phplint, phpstan, phpunit, pecl, phing, phinx, phinx:1.2.3, phive, phpunit-bridge, phpunit-polyfills, php-config, phpize, protoc, symfony, vapor, wp',
|
||||
[
|
||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||
'add_blackfire',
|
||||
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
|
||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
|
||||
'add_composertool flex flex symfony/',
|
||||
'add_grpc_php_plugin latest',
|
||||
'add_tool https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar parallel-lint "--version"',
|
||||
'add_tool https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.2.1/php-cs-fixer.phar php-cs-fixer "-V"',
|
||||
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
|
||||
'add_composertool phplint phplint overtrue/',
|
||||
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan "-V"',
|
||||
'add_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"',
|
||||
'add_pecl',
|
||||
'add_tool https://www.phing.info/get/phing-latest.phar phing "-v"',
|
||||
'add_composertool phinx phinx robmorgan/',
|
||||
'add_composertool phinx phinx:1.2.3 robmorgan/',
|
||||
'add_tool https://phar.io/releases/phive.phar phive "status"',
|
||||
'add_composertool phpunit-bridge phpunit-bridge symfony/',
|
||||
'add_composertool phpunit-polyfills phpunit-polyfills yoast/',
|
||||
'add_devtools php-config',
|
||||
'add_devtools phpize',
|
||||
'add_protoc latest',
|
||||
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony-cli "version"',
|
||||
'add_composertool vapor-cli vapor-cli laravel/',
|
||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||
]
|
||||
]
|
||||
])('checking addTools on linux', async (tools_csv, scripts) => {
|
||||
const expected = await tools.addTools(tools_csv, '7.4', 'linux');
|
||||
scripts.forEach(script => {
|
||||
expect(expected).toContain(script);
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
'behat, blackfire, blackfire-player, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, symfony-cli, symfony:1.2.3, vapor-cli, wp-cli',
|
||||
[
|
||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||
'add_composertool behat behat behat/',
|
||||
'add_blackfire',
|
||||
'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"',
|
||||
'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"',
|
||||
'add_composertool composer-require-checker composer-require-checker maglnet/',
|
||||
'add_composertool composer-unused composer-unused icanhazstring/',
|
||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr "-V"',
|
||||
'add_composertool flex flex symfony/',
|
||||
'add_grpc_php_plugin 1.2.3',
|
||||
'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection "-V"',
|
||||
'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan "-v"',
|
||||
'add_tool https://github.com/phan/phan/releases/download/1.2.3/phan.phar phan "-v"',
|
||||
'add_tool https://www.phing.info/get/phing-1.2.3.phar phing "-v"',
|
||||
'add_composertool phinx phinx robmorgan/',
|
||||
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive',
|
||||
'add_devtools php-config',
|
||||
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcbf.phar phpcbf "--version"',
|
||||
'add_tool https://phar.phpunit.de/phpcpd.phar phpcpd "--version"',
|
||||
'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs "--version"',
|
||||
'add_tool https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar phpDocumentor "--version"',
|
||||
'add_devtools phpize',
|
||||
'add_tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||
'add_composertool phpspec phpspec phpspec/',
|
||||
'add_composertool phpunit-bridge phpunit-bridge:5.6.* symfony/',
|
||||
'add_composertool phpunit-polyfills phpunit-polyfills:1.0.1 yoast/',
|
||||
'add_protoc 1.2.3',
|
||||
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
||||
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony-cli "version"',
|
||||
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony-cli "version"',
|
||||
'add_composertool vapor-cli vapor-cli laravel/',
|
||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||
]
|
||||
]
|
||||
])('checking addTools on darwin', async (tools_csv, scripts) => {
|
||||
const expected = await tools.addTools(tools_csv, '7.4', 'darwin');
|
||||
scripts.forEach(script => {
|
||||
expect(expected).toContain(script);
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
'blackfire, blackfire-player:1.2.3, cs2pr, deployer, does_not_exist, flex, phinx, phive:0.13.2, php-config, phpize, phpmd, simple-phpunit, symfony, wp',
|
||||
[
|
||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||
'Add-Blackfire',
|
||||
'Add-Tool https://get.blackfire.io/blackfire-player-v1.2.3.phar blackfire-player "-V"',
|
||||
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"',
|
||||
'Add-Tool https://deployer.org/deployer.phar deployer "-V"',
|
||||
'Tool does_not_exist is not supported',
|
||||
'Add-Composertool flex flex symfony/',
|
||||
'Add-Composertool phinx phinx robmorgan/',
|
||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive "status"',
|
||||
'php-config is not a windows tool',
|
||||
'phpize is not a windows tool',
|
||||
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||
'Add-Composertool phpunit-bridge phpunit-bridge symfony/',
|
||||
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony-cli "version"',
|
||||
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||
]
|
||||
]
|
||||
])('checking addTools on Windows', async (tools_csv, scripts) => {
|
||||
const expected = await tools.addTools(tools_csv, '7.4', 'win32');
|
||||
scripts.forEach(script => {
|
||||
expect(expected).toContain(script);
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
'composer:v1, codeception/codeception, prestissimo, hirak/prestissimo, composer-prefetcher, narrowspark/automatic-composer-prefetcher, phinx: 1.2, robmorgan/phinx: ^1.2, user/tool:1.2.3, user/tool:~1.2',
|
||||
[
|
||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer',
|
||||
'Add-Composertool codeception codeception codeception/',
|
||||
'Add-Composertool prestissimo prestissimo hirak/',
|
||||
'Add-Composertool automatic-composer-prefetcher automatic-composer-prefetcher narrowspark/',
|
||||
'Add-Composertool phinx phinx:1.2.* robmorgan/',
|
||||
'Add-Composertool phinx phinx:^1.2 robmorgan/',
|
||||
'Add-Composertool tool tool:1.2.3 user/',
|
||||
'Add-Composertool tool tool:~1.2 user/'
|
||||
]
|
||||
]
|
||||
])(
|
||||
'checking addTools with composer tool using user/tool as input',
|
||||
async (tools_csv, scripts) => {
|
||||
const expected = await tools.addTools(tools_csv, '7.4', 'win32');
|
||||
scripts.forEach(script => {
|
||||
expect(expected).toContain(script);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
tools_csv | script
|
||||
${'none'} | ${''}
|
||||
${'none, phpunit'} | ${'\nstep_log "Setup Tools"\nadd_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer latest\n\nadd_tool https://phar.phpunit.de/phpunit.phar phpunit "--version"'}
|
||||
${'composer:preview'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer preview'}
|
||||
${'composer, composer:v1'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'}
|
||||
${'composer:v1, composer:preview, composer:snapshot'} | ${'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer snapshot'}
|
||||
`('checking composer setup: $tools_csv', async ({tools_csv, script}) => {
|
||||
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
||||
});
|
||||
|
||||
it.each`
|
||||
tools_csv | token | script
|
||||
${'cs2pr:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "cs2pr" "Invalid token"'}
|
||||
${'phpunit:1.2'} | ${'invalid_token'} | ${'add_log "$cross" "phpunit" "Invalid token"'}
|
||||
${'phpunit:0.1'} | ${'no_data'} | ${'add_log "$cross" "phpunit" "No version found with prefix 0.1."'}
|
||||
`('checking error: $tools_csv', async ({tools_csv, token, script}) => {
|
||||
process.env['COMPOSER_TOKEN'] = token;
|
||||
expect(await tools.addTools(tools_csv, '7.4', 'linux')).toContain(script);
|
||||
});
|
||||
});
|
@ -17,136 +17,193 @@ async function cleanup(path: string): Promise<void> {
|
||||
}
|
||||
|
||||
describe('Utils tests', () => {
|
||||
it('checking readEnv', async () => {
|
||||
process.env['test'] = 'setup-php';
|
||||
process.env['test-hyphen'] = 'setup-php';
|
||||
expect(await utils.readEnv('test')).toBe('setup-php');
|
||||
expect(await utils.readEnv('TEST')).toBe('setup-php');
|
||||
expect(await utils.readEnv('test_hyphen')).toBe('setup-php');
|
||||
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
|
||||
expect(await utils.readEnv('undefined')).toBe('');
|
||||
});
|
||||
|
||||
it('checking getInput', async () => {
|
||||
process.env['test'] = 'setup-php';
|
||||
process.env['undefined'] = '';
|
||||
expect(await utils.getInput('test', false)).toBe('setup-php');
|
||||
expect(await utils.getInput('undefined', false)).toBe('');
|
||||
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
|
||||
expect(await utils.getInput('DoesNotExist', false)).toBe('');
|
||||
await expect(async () => {
|
||||
await utils.getInput('DoesNotExist', true);
|
||||
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
|
||||
});
|
||||
|
||||
it('checking fetch', async () => {
|
||||
const manifest = await utils.getManifestURL();
|
||||
let response: Record<string, string> = await utils.fetch(manifest);
|
||||
expect(response.error).toBe(undefined);
|
||||
expect(response.data).toContain('latest');
|
||||
|
||||
response = await utils.fetch(manifest, 'invalid_token');
|
||||
expect(response.error).not.toBe(undefined);
|
||||
expect(response.data).toBe(undefined);
|
||||
});
|
||||
|
||||
it('checking getManifestURL', async () => {
|
||||
expect(await utils.getManifestURL()).toContain('php-versions.json');
|
||||
});
|
||||
|
||||
it('checking parseVersion', async () => {
|
||||
jest
|
||||
.spyOn(utils, 'fetch')
|
||||
.mockImplementation(
|
||||
async (url, token?): Promise<Record<string, string>> => {
|
||||
if (!token || token === 'valid_token') {
|
||||
return {data: `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`};
|
||||
} else {
|
||||
return {error: 'Invalid token'};
|
||||
}
|
||||
}
|
||||
);
|
||||
expect(await utils.parseVersion('latest')).toBe('8.1');
|
||||
expect(await utils.parseVersion('7')).toBe('7.0');
|
||||
expect(await utils.parseVersion('7.4')).toBe('7.4');
|
||||
expect(await utils.parseVersion('5.x')).toBe('5.6');
|
||||
expect(await utils.parseVersion('4.x')).toBe(undefined);
|
||||
});
|
||||
|
||||
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;
|
||||
});
|
||||
expect(sum).toBe(10);
|
||||
const array: Array<string> = ['a', 'b', 'c'];
|
||||
let concat = '';
|
||||
await utils.asyncForEach(
|
||||
array,
|
||||
async function (str: string): Promise<void> {
|
||||
concat += str;
|
||||
}
|
||||
);
|
||||
expect(concat).toBe('abc');
|
||||
});
|
||||
|
||||
it('checking readScripts', async () => {
|
||||
let rc: string = fs.readFileSync(
|
||||
path.join(__dirname, '../src/scripts/7.4.sh'),
|
||||
'utf8'
|
||||
);
|
||||
let darwin: string = fs.readFileSync(
|
||||
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 readFile', async () => {
|
||||
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.readFile('darwin.sh', 'src/scripts')).toBe(darwin);
|
||||
expect(await utils.readFile('darwin.sh', 'src/scripts')).toBe(darwin);
|
||||
expect(await utils.readFile('linux.sh', 'src/scripts')).toBe(linux);
|
||||
expect(await utils.readFile('linux.sh', 'src/scripts')).toBe(linux);
|
||||
expect(await utils.readFile('win32.ps1', 'src/scripts')).toBe(win32);
|
||||
expect(await utils.readFile('win32.ps1', 'src/scripts')).toBe(win32);
|
||||
});
|
||||
|
||||
it('checking writeScripts', async () => {
|
||||
let testString: string = 'sudo apt-get install php';
|
||||
await utils.writeScript('test.sh', '10', testString);
|
||||
await fs.readFile(path.join(__dirname, '../10test.sh'), function(
|
||||
error: any,
|
||||
data: Buffer
|
||||
) {
|
||||
expect(testString).toBe(data.toString());
|
||||
});
|
||||
await cleanup('./10test.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: Error | null, data: Buffer) {
|
||||
expect(testString).toBe(data.toString());
|
||||
}
|
||||
);
|
||||
await cleanup(script_path);
|
||||
});
|
||||
|
||||
it('checking extensionArray', async () => {
|
||||
expect(await utils.extensionArray('a, b, php_c, php-d')).toEqual([
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd'
|
||||
]);
|
||||
expect(
|
||||
await utils.extensionArray('a, :b, php_c, none, php-d, Zend e, :Zend f')
|
||||
).toEqual(['none', 'a', ':b', 'c', 'd', 'e', ':f']);
|
||||
|
||||
expect(await utils.extensionArray('')).toEqual([]);
|
||||
expect(await utils.extensionArray(' ')).toEqual([]);
|
||||
});
|
||||
|
||||
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('\'a=1,2\', "b=3, 4", c=5, d=~e~')).toEqual([
|
||||
'a=1,2',
|
||||
'b=3, 4',
|
||||
'c=5',
|
||||
"d='~e~'"
|
||||
]);
|
||||
expect(await utils.CSVArray('a=\'1,2\', b="3, 4", c=5')).toEqual([
|
||||
'a=1,2',
|
||||
'b=3, 4',
|
||||
'c=5'
|
||||
]);
|
||||
expect(
|
||||
await utils.CSVArray('a=E_ALL, b=E_ALL & ~ E_ALL, c="E_ALL", d=\'E_ALL\'')
|
||||
).toEqual(['a=E_ALL', 'b=E_ALL & ~ E_ALL', 'c=E_ALL', 'd=E_ALL']);
|
||||
expect(await utils.CSVArray('')).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(
|
||||
"Write-Host '" + message + "' -ForegroundColor yellow"
|
||||
);
|
||||
expect(warning_log).toEqual('printf "\\033[33;1m' + message + ' \\033[0m"');
|
||||
warning_log = await utils.log(message, 'linux', 'warning');
|
||||
expect(warning_log).toEqual('echo "\\033[33;1m' + message + '\\033[0m"');
|
||||
warning_log = await utils.log(message, 'darwin', 'warning');
|
||||
expect(warning_log).toEqual('echo "\\033[33;1m' + message + '\\033[0m"');
|
||||
|
||||
let error_log: string = await utils.log(message, 'win32', 'error');
|
||||
expect(error_log).toEqual(
|
||||
"Write-Host '" + message + "' -ForegroundColor red"
|
||||
);
|
||||
expect(error_log).toEqual('printf "\\033[31;1m' + message + ' \\033[0m"');
|
||||
error_log = await utils.log(message, 'linux', 'error');
|
||||
expect(error_log).toEqual('echo "\\033[31;1m' + message + '\\033[0m"');
|
||||
error_log = await utils.log(message, 'darwin', 'error');
|
||||
expect(error_log).toEqual('echo "\\033[31;1m' + message + '\\033[0m"');
|
||||
|
||||
let success_log: string = await utils.log(message, 'win32', 'success');
|
||||
expect(success_log).toEqual(
|
||||
"Write-Host '" + message + "' -ForegroundColor green"
|
||||
);
|
||||
expect(success_log).toEqual('printf "\\033[32;1m' + message + ' \\033[0m"');
|
||||
success_log = await utils.log(message, 'linux', 'success');
|
||||
expect(success_log).toEqual('echo "\\033[32;1m' + message + '\\033[0m"');
|
||||
success_log = await utils.log(message, 'darwin', 'success');
|
||||
expect(success_log).toEqual('echo "\\033[32;1m' + message + '\\033[0m"');
|
||||
|
||||
success_log = await utils.log(message, 'win32', 'success', 'Test win');
|
||||
expect(success_log).toEqual(
|
||||
"Write-Host 'Test win: " + message + "' -ForegroundColor green"
|
||||
);
|
||||
});
|
||||
let step_log: string = await utils.stepLog(message, 'win32');
|
||||
expect(step_log).toEqual('Step-Log "Test message"');
|
||||
step_log = await utils.stepLog(message, 'linux');
|
||||
expect(step_log).toEqual('step_log "Test message"');
|
||||
step_log = await utils.stepLog(message, 'darwin');
|
||||
expect(step_log).toEqual('step_log "Test message"');
|
||||
step_log = await utils.stepLog(message, 'openbsd');
|
||||
expect(step_log).toContain('Platform openbsd is not supported');
|
||||
|
||||
it('checking log with prefix', async () => {
|
||||
let message: string = 'Test message';
|
||||
let prefix_log: string = await utils.log(
|
||||
message,
|
||||
'linux',
|
||||
'success',
|
||||
'Test Prefix'
|
||||
);
|
||||
expect(prefix_log).toEqual(
|
||||
'echo "\\033[32;1mTest Prefix: ' + message + '\\033[0m"'
|
||||
);
|
||||
prefix_log = await utils.log(message, 'darwin', 'success', 'Test');
|
||||
expect(prefix_log).toEqual(
|
||||
'echo "\\033[32;1mTest: ' + message + '\\033[0m"'
|
||||
let add_log: string = await utils.addLog(
|
||||
'tick',
|
||||
'xdebug',
|
||||
'enabled',
|
||||
'win32'
|
||||
);
|
||||
expect(add_log).toEqual('Add-Log "tick" "xdebug" "enabled"');
|
||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'linux');
|
||||
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'darwin');
|
||||
expect(add_log).toEqual('add_log "tick" "xdebug" "enabled"');
|
||||
add_log = await utils.addLog('tick', 'xdebug', 'enabled', 'openbsd');
|
||||
expect(add_log).toContain('Platform openbsd is not supported');
|
||||
});
|
||||
|
||||
it('checking getExtensionPrefix', async () => {
|
||||
@ -155,6 +212,93 @@ 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');
|
||||
});
|
||||
|
||||
it('checking suppressOutput', async () => {
|
||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
it('checking getUnsupportedLog', async () => {
|
||||
expect(await utils.getUnsupportedLog('ext', '5.6', 'linux')).toContain(
|
||||
'add_log "$cross" "ext" "ext is not supported on PHP 5.6"'
|
||||
);
|
||||
});
|
||||
|
||||
it('checking getCommand', async () => {
|
||||
expect(await utils.getCommand('linux', 'tool')).toBe('add_tool ');
|
||||
expect(await utils.getCommand('darwin', 'tool')).toBe('add_tool ');
|
||||
expect(await utils.getCommand('win32', 'tool')).toBe('Add-Tool ');
|
||||
expect(await utils.getCommand('openbsd', 'tool')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
it('checking joins', async () => {
|
||||
expect(await utils.joins('a', 'b', 'c')).toBe('a b c');
|
||||
});
|
||||
|
||||
it('checking scriptExtension', async () => {
|
||||
expect(await utils.scriptExtension('linux')).toBe('.sh');
|
||||
expect(await utils.scriptExtension('darwin')).toBe('.sh');
|
||||
expect(await utils.scriptExtension('win32')).toBe('.ps1');
|
||||
expect(await utils.scriptExtension('openbsd')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
it('checking scriptTool', async () => {
|
||||
expect(await utils.scriptTool('linux')).toBe('bash');
|
||||
expect(await utils.scriptTool('darwin')).toBe('bash');
|
||||
expect(await utils.scriptTool('win32')).toBe('pwsh');
|
||||
expect(await utils.scriptTool('openbsd')).toContain(
|
||||
'Platform openbsd is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
it('checking customPackage', async () => {
|
||||
const script_path: string = path.join('ext', 'pkg.sh');
|
||||
expect(await utils.customPackage('pkg', 'ext', '1.2.3', 'linux')).toContain(
|
||||
script_path + '\nadd_pkg 1.2.3'
|
||||
);
|
||||
expect(
|
||||
await utils.customPackage('pdo_pkg', 'ext', '1.2.3', 'linux')
|
||||
).toContain(script_path + '\nadd_pkg 1.2.3');
|
||||
expect(
|
||||
await utils.customPackage('pkg8', 'ext', '1.2.3', 'linux')
|
||||
).toContain(script_path + '\nadd_pkg 1.2.3');
|
||||
});
|
||||
|
||||
it('checking parseExtensionSource', async () => {
|
||||
expect(
|
||||
await utils.parseExtensionSource(
|
||||
'ext-org-name/repo-name@release',
|
||||
'extension'
|
||||
)
|
||||
).toContain(
|
||||
'\nadd_extension_from_source ext https://github.com org-name repo-name release extension'
|
||||
);
|
||||
expect(
|
||||
await utils.parseExtensionSource(
|
||||
'ext-https://sub.domain.tld/org/repo@release',
|
||||
'extension'
|
||||
)
|
||||
).toContain(
|
||||
'\nadd_extension_from_source ext https://sub.domain.tld org repo release extension'
|
||||
);
|
||||
expect(
|
||||
await utils.parseExtensionSource(
|
||||
'ext-https://sub.domain.XN--tld/org/repo@release',
|
||||
'extension'
|
||||
)
|
||||
).toContain(
|
||||
'\nadd_extension_from_source ext https://sub.domain.XN--tld org repo release extension'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
25
action.yml
25
action.yml
@ -1,22 +1,29 @@
|
||||
name: 'Setup PHP Action'
|
||||
author: shivammathur
|
||||
description: 'Setup a PHP environment with composer and add it to the PATH'
|
||||
description: 'GitHub Action for PHP'
|
||||
branding:
|
||||
icon: 'activity'
|
||||
color: 'purple'
|
||||
icon: 'play-circle'
|
||||
inputs:
|
||||
php-version:
|
||||
description: 'PHP version to be installed.'
|
||||
description: 'Setup PHP version.'
|
||||
default: '8.1'
|
||||
required: true
|
||||
extension-csv:
|
||||
description: '(Optional) Comma seperated list of PHP extensions to be installed.'
|
||||
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) Driver to calculate code coverage (Accepts: xdebug and pcov)'
|
||||
description: 'Setup code coverage driver.'
|
||||
required: false
|
||||
tools:
|
||||
description: 'Setup popular tools globally.'
|
||||
required: false
|
||||
outputs:
|
||||
php-version:
|
||||
description: 'PHP version in semver format'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'lib/install.js'
|
||||
main: 'dist/index.js'
|
||||
|
3062
dist/index.js
vendored
Normal file
3062
dist/index.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,54 +0,0 @@
|
||||
name: Testing Laravel with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
laravel:
|
||||
name: Laravel (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_PASSWORD: password
|
||||
BROADCAST_DRIVER: log
|
||||
CACHE_DRIVER: redis
|
||||
QUEUE_CONNECTION: redis
|
||||
SESSION_DRIVER: redis
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: laravel
|
||||
ports:
|
||||
- 3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 15
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
php-versions: ['7.2', '7.3']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extension-csv: mbstring #optional
|
||||
coverage: xdebug #optional
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: |
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
- name: Clear Config
|
||||
run: php artisan config:clear
|
||||
- name: Run Migration
|
||||
run: php artisan migrate -v
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
@ -1,54 +0,0 @@
|
||||
name: Testing Laravel with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
laravel:
|
||||
name: Laravel (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BROADCAST_DRIVER: log
|
||||
CACHE_DRIVER: redis
|
||||
QUEUE_CONNECTION: redis
|
||||
SESSION_DRIVER: redis
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 15
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
php-versions: ['7.2', '7.3']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extension-csv: mbstring #optional
|
||||
coverage: xdebug #optional
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: |
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
- name: Clear Config
|
||||
run: php artisan config:clear
|
||||
- name: Run Migration
|
||||
run: php artisan migrate -v
|
||||
env:
|
||||
POSTGRES_HOST: localhost
|
||||
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
|
@ -1,21 +0,0 @@
|
||||
name: Testing Slim Framework
|
||||
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]
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extension-csv: 'mbstring'
|
||||
coverage: 'xdebug'
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
|
32
examples/bedrock.yml
Normal file
32
examples/bedrock.yml
Normal file
@ -0,0 +1,32 @@
|
||||
# GitHub Action for roots/bedrock
|
||||
name: Testing Bedrock
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
bedrock:
|
||||
name: Bedrock (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.1', '7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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
|
31
examples/blackfire-player.yml
Normal file
31
examples/blackfire-player.yml
Normal 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
31
examples/blackfire.yml
Normal 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 cli
|
||||
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
114
examples/cakephp-mysql.yml
Normal file
@ -0,0 +1,114 @@
|
||||
# GitHub Action for CakePHP with MySQL and Redis
|
||||
# Tested with https://github.com/cakephp/app
|
||||
name: Testing CakePHP with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: cakephp
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Static Analysis using PHPStan
|
||||
run: phpstan analyse --no-progress src/
|
112
examples/cakephp-postgres.yml
Normal file
112
examples/cakephp-postgres.yml
Normal file
@ -0,0 +1,112 @@
|
||||
# GitHub Action for CakePHP with PostgreSQL and Redis
|
||||
# Tested with https://github.com/cakephp/app
|
||||
name: Testing CakePHP with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Static Analysis using PHPStan
|
||||
run: phpstan analyse --no-progress src/
|
92
examples/cakephp.yml
Normal file
92
examples/cakephp.yml
Normal file
@ -0,0 +1,92 @@
|
||||
# GitHub Action for CakePHP
|
||||
# Tested with https://github.com/cakephp/app
|
||||
name: Testing CakePHP
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Static Analysis using PHPStan
|
||||
run: phpstan analyse --no-progress src/
|
34
examples/codeigniter.yml
Normal file
34
examples/codeigniter.yml
Normal file
@ -0,0 +1,34 @@
|
||||
# GitHub Action for CodeIgniter
|
||||
name: Testing CodeIgniter
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, intl, curl, dom
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
74
examples/laravel-mysql.yml
Normal file
74
examples/laravel-mysql.yml
Normal file
@ -0,0 +1,74 @@
|
||||
# GitHub Action for Laravel with MySQL and Redis
|
||||
name: Testing Laravel with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
laravel:
|
||||
name: Laravel (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_DATABASE: laravel
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: password
|
||||
BROADCAST_DRIVER: log
|
||||
CACHE_DRIVER: redis
|
||||
QUEUE_CONNECTION: redis
|
||||
SESSION_DRIVER: redis
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: laravel
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, fileinfo, mysql
|
||||
coverage: xdebug #optional
|
||||
- name: Start mysql service
|
||||
run: sudo /etc/init.d/mysql start
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: |
|
||||
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
php artisan key:generate
|
||||
- name: Clear Config
|
||||
run: php artisan config:clear
|
||||
- name: Run Migration
|
||||
run: php artisan migrate -v
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
74
examples/laravel-postgres.yml
Normal file
74
examples/laravel-postgres.yml
Normal file
@ -0,0 +1,74 @@
|
||||
# GitHub Action for Laravel with PostgreSQL and Redis
|
||||
name: Testing Laravel with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
laravel:
|
||||
name: Laravel (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BROADCAST_DRIVER: log
|
||||
CACHE_DRIVER: redis
|
||||
QUEUE_CONNECTION: redis
|
||||
SESSION_DRIVER: redis
|
||||
DB_CONNECTION: pgsql
|
||||
DB_HOST: localhost
|
||||
DB_PASSWORD: postgres
|
||||
DB_USERNAME: postgres
|
||||
DB_DATABASE: postgres
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, fileinfo, pgsql
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: |
|
||||
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
php artisan key:generate
|
||||
- name: Clear Config
|
||||
run: php artisan config:clear
|
||||
- name: Run Migration
|
||||
run: php artisan migrate -v
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
42
examples/laravel.yml
Normal file
42
examples/laravel.yml
Normal file
@ -0,0 +1,42 @@
|
||||
# GitHub Action for Laravel
|
||||
name: Testing Laravel
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
laravel:
|
||||
name: Laravel (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, fileinfo
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: |
|
||||
php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
php artisan key:generate
|
||||
- name: Clear Config
|
||||
run: php artisan config:clear
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
74
examples/lumen-mysql.yml
Normal file
74
examples/lumen-mysql.yml
Normal file
@ -0,0 +1,74 @@
|
||||
# GitHub Action for Lumen with MySQL and Redis
|
||||
name: Testing Lumen with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
lumen:
|
||||
name: Lumen (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_DATABASE: lumen
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: password
|
||||
BROADCAST_DRIVER: log
|
||||
CACHE_DRIVER: redis
|
||||
QUEUE_CONNECTION: redis
|
||||
SESSION_DRIVER: redis
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: lumen
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, fileinfo, mysql
|
||||
coverage: xdebug #optional
|
||||
- name: Start mysql service
|
||||
run: sudo /etc/init.d/mysql start
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: |
|
||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
composer require predis/predis illuminate/redis
|
||||
- name: Prepare the application
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Register Redis as service provider
|
||||
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
||||
- name: Run Migration
|
||||
run: php artisan migrate -v
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
74
examples/lumen-postgres.yml
Normal file
74
examples/lumen-postgres.yml
Normal file
@ -0,0 +1,74 @@
|
||||
# GitHub Action for Lumen with PostgreSQL and Redis
|
||||
name: Testing Lumen with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
laravel:
|
||||
name: Lumen (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BROADCAST_DRIVER: log
|
||||
CACHE_DRIVER: redis
|
||||
QUEUE_CONNECTION: redis
|
||||
SESSION_DRIVER: redis
|
||||
DB_CONNECTION: pgsql
|
||||
DB_HOST: localhost
|
||||
DB_PASSWORD: postgres
|
||||
DB_USERNAME: postgres
|
||||
DB_DATABASE: postgres
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, fileinfo, pgsql
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: |
|
||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
composer require predis/predis illuminate/redis
|
||||
- name: Prepare the application
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Register Redis as service provider
|
||||
run: sed -i '$i\$app->register(Illuminate\\Redis\\RedisServiceProvider::class);' bootstrap/app.php
|
||||
- name: Run Migration
|
||||
run: php artisan migrate -v
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports[5432] }}
|
||||
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
38
examples/lumen.yml
Normal file
38
examples/lumen.yml
Normal file
@ -0,0 +1,38 @@
|
||||
# GitHub Action for Lumen
|
||||
name: Unit Testing Lumen
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
lumen:
|
||||
name: Lumen (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, fileinfo, mysql
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
74
examples/phalcon-mysql.yml
Normal file
74
examples/phalcon-mysql.yml
Normal file
@ -0,0 +1,74 @@
|
||||
# GitHub Action for Phalcon with MySQL
|
||||
## Notes
|
||||
## Make sure you have .env.example or .env file in your project
|
||||
## and you have loaded Dotenv (https://github.com/vlucas/phpdotenv)
|
||||
name: Testing Phalcon with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
phalcon:
|
||||
name: Phalcon (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_ADAPTER: mysql
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_NAME: phalcon
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: password
|
||||
CODECEPTION_URL: 127.0.0.1
|
||||
CODECEPTION_PORT: 8888
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: phalcon
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
# For phalcon 3.x, use
|
||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
|
||||
coverage: xdebug #optional
|
||||
- name: Start mysql service
|
||||
run: sudo /etc/init.d/mysql start
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Run Migration
|
||||
run: |
|
||||
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
||||
vendor/bin/phinx migrate
|
||||
vendor/bin/phinx seed:run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
- name: Run Tests
|
||||
run: |
|
||||
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
||||
vendor/bin/codecept build
|
||||
vendor/bin/codecept run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
73
examples/phalcon-postgres.yml
Normal file
73
examples/phalcon-postgres.yml
Normal file
@ -0,0 +1,73 @@
|
||||
# GitHub Action for Phalcon with PostgreSQL
|
||||
## Notes
|
||||
## Make sure you have .env.example or .env file in your project
|
||||
## and you have loaded Dotenv (https://github.com/vlucas/phpdotenv)
|
||||
name: Testing Phalcon with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
phalcon:
|
||||
name: Phalcon (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_ADAPTER: pgsql
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_NAME: postgres
|
||||
DB_USERNAME: postgres
|
||||
DB_PASSWORD: postgres
|
||||
CODECEPTION_URL: 127.0.0.1
|
||||
CODECEPTION_PORT: 8888
|
||||
DB_CONNECTION: pgsql
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
# For phalcon 3.x, use
|
||||
# php-versions: ['7.0', '7.1', '7.2', '7.3']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Run Migration
|
||||
run: |
|
||||
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
||||
vendor/bin/phinx migrate
|
||||
vendor/bin/phinx seed:run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||
- name: Run Tests
|
||||
run: |
|
||||
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
||||
vendor/bin/codecept build
|
||||
vendor/bin/codecept run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
57
examples/sage.yml
Normal file
57
examples/sage.yml
Normal file
@ -0,0 +1,57 @@
|
||||
# GitHub Action for roots/sage
|
||||
name: Testing Sage
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
sage:
|
||||
name: Sage (PHP ${{ matrix.php-versions }} & Node ${{ matrix.node-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.1', '7.2', '7.3', '7.4']
|
||||
node-versions: ['8', '10']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-versions }}
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install yarn dependencies
|
||||
run: yarn -V
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Yarn test and build
|
||||
run: |
|
||||
yarn run test
|
||||
yarn run build
|
||||
yarn run rmdist
|
||||
yarn run "build:production"
|
||||
- name: PHP test
|
||||
run: composer test
|
34
examples/slim-framework.yml
Normal file
34
examples/slim-framework.yml
Normal file
@ -0,0 +1,34 @@
|
||||
# GitHub Action for Slim Framework
|
||||
name: Testing Slim Framework
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, simplexml, dom
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
57
examples/symfony-mysql.yml
Normal file
57
examples/symfony-mysql.yml
Normal file
@ -0,0 +1,57 @@
|
||||
# GitHub Action for Symfony with MySQL
|
||||
name: Testing Symfony with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
symfony:
|
||||
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: symfony
|
||||
MYSQL_DATABASE: symfony
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
tools: phpunit-bridge
|
||||
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: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Run Migration
|
||||
run: |
|
||||
composer require --dev symfony/orm-pack
|
||||
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||
env:
|
||||
DATABASE_URL: mysql://root:symfony@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony
|
||||
- name: Install PHPUnit
|
||||
run: simple-phpunit install
|
||||
- name: Run tests
|
||||
run: simple-phpunit --coverage-text
|
55
examples/symfony-postgres.yml
Normal file
55
examples/symfony-postgres.yml
Normal file
@ -0,0 +1,55 @@
|
||||
# GitHub Action for Symfony with PostgreSQL
|
||||
name: Testing Symfony with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
symfony:
|
||||
name: Symfony (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
tools: phpunit-bridge
|
||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Run Migration
|
||||
run: |
|
||||
composer require --dev symfony/orm-pack
|
||||
php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
|
||||
php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
|
||||
- name: Install PHPUnit
|
||||
run: simple-phpunit install
|
||||
- name: Run tests
|
||||
run: simple-phpunit --coverage-text
|
39
examples/symfony.yml
Normal file
39
examples/symfony.yml
Normal file
@ -0,0 +1,39 @@
|
||||
# GitHub Action for Symfony
|
||||
name: Testing Symfony
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
symfony:
|
||||
name: Symfony (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-versions: ['7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
tools: phpunit-bridge
|
||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.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: Install PHPUnit
|
||||
run: simple-phpunit install
|
||||
- name: Run tests
|
||||
run: simple-phpunit --coverage-text
|
73
examples/yii2-mysql.yml
Normal file
73
examples/yii2-mysql.yml
Normal file
@ -0,0 +1,73 @@
|
||||
# GitHub Action for Yii Framework with MySQL
|
||||
name: Testing Yii2 with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
yii:
|
||||
name: Yii2 (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: yii
|
||||
TEST_DB_USERNAME: root
|
||||
TEST_DB_PASSWORD: yii
|
||||
DB_CHARSET: utf8
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: yii
|
||||
MYSQL_DATABASE: yii
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set Node.js 10.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 10.x
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, intl, gd, imagick, zip, dom, mysql
|
||||
coverage: xdebug #optional
|
||||
- name: Start mysql service
|
||||
run: sudo /etc/init.d/mysql start
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: |
|
||||
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
||||
php console/yii app/setup
|
||||
npm install --development
|
||||
npm run build
|
||||
env:
|
||||
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||
- name: Run Tests
|
||||
run: |
|
||||
vendor/bin/codecept build
|
||||
php tests/bin/yii app/setup --interactive=0
|
||||
nohup php -S localhost:8080 > yii.log 2>&1 &
|
||||
vendor/bin/codecept run
|
||||
env:
|
||||
DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
||||
TEST_DB_DSN: mysql:host=127.0.0.1;port=${{ job.services.mysql.ports['3306'] }};dbname=yii
|
71
examples/yii2-postgres.yml
Normal file
71
examples/yii2-postgres.yml
Normal file
@ -0,0 +1,71 @@
|
||||
# GitHub Action for Yii Framework with PostgreSQL
|
||||
name: Testing Yii2 with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
yii:
|
||||
name: Yii2 (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_USERNAME: postgres
|
||||
DB_PASSWORD: postgres
|
||||
TEST_DB_USERNAME: postgres
|
||||
TEST_DB_PASSWORD: postgres
|
||||
DB_CHARSET: utf8
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set Node.js 10.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 10.x
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: |
|
||||
php -r "file_exists('.env') || copy('.env.dist', '.env');"
|
||||
php console/yii app/setup
|
||||
npm install --development
|
||||
npm run build
|
||||
env:
|
||||
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||
- name: Run Tests
|
||||
run: |
|
||||
vendor/bin/codecept build
|
||||
php tests/bin/yii app/setup --interactive=0
|
||||
nohup php -S localhost:8080 > yii.log 2>&1 &
|
||||
vendor/bin/codecept run
|
||||
env:
|
||||
DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
||||
TEST_DB_DSN: pgsql:host=127.0.0.1;port=${{ job.services.postgres.ports['5432'] }};dbname=postgres
|
36
examples/zend-framework.yml
Normal file
36
examples/zend-framework.yml
Normal file
@ -0,0 +1,36 @@
|
||||
# GitHub Action for Zend Framework
|
||||
name: Testing Zend Framework
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mbstring, bcmath, curl, intl
|
||||
coverage: xdebug #optional
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
# Use composer.json for key, if composer.lock is not committed.
|
||||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
composer require --dev phpunit/phpunit squizlabs/php_codesniffer zendframework/zend-test
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
@ -9,4 +9,4 @@ module.exports = {
|
||||
},
|
||||
verbose: true,
|
||||
collectCoverage: true
|
||||
};
|
||||
};
|
||||
|
350
lib/features.js
350
lib/features.js
@ -1,350 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils = __importStar(require("./utils"));
|
||||
const pecl = __importStar(require("./pecl"));
|
||||
function addExtension(extension_csv, version, os_version, log_prefix = 'Add Extension') {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
switch (os_version) {
|
||||
case 'win32':
|
||||
return yield addExtensionWindows(extension_csv, version, log_prefix);
|
||||
case 'darwin':
|
||||
return yield addExtensionDarwin(extension_csv, version, log_prefix);
|
||||
case 'linux':
|
||||
return yield addExtensionLinux(extension_csv, version, log_prefix);
|
||||
default:
|
||||
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error', log_prefix);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.addExtension = addExtension;
|
||||
function addINIValues(ini_values_csv, os_version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
switch (os_version) {
|
||||
case 'win32':
|
||||
return yield addINIValuesWindows(ini_values_csv);
|
||||
case 'darwin':
|
||||
case 'linux':
|
||||
return yield addINIValuesUnix(ini_values_csv);
|
||||
default:
|
||||
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error', 'Add Config');
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.addINIValues = addINIValues;
|
||||
/**
|
||||
* Enable extensions which are installed but not enabled on windows
|
||||
*
|
||||
* @param extension
|
||||
*/
|
||||
function enableExtensionWindows(extension, log_prefix) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return (`try {
|
||||
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
||||
if(!(php -m | findstr -i ${extension}) -and $exist) {
|
||||
Add-Content C:\\tools\\php\\php.ini "${yield utils.getExtensionPrefix(extension)}=php_${extension}.dll"\n` +
|
||||
(yield utils.log('Enabled ' + extension, 'win32', 'success', log_prefix)) +
|
||||
` } elseif(php -m | findstr -i ${extension}) {\n` +
|
||||
(yield utils.log(extension + ' was already enabled', 'win32', 'success', log_prefix)) +
|
||||
` }
|
||||
} catch [Exception] {\n` +
|
||||
(yield utils.log(extension + ' could not be enabled', 'win32', 'error', log_prefix)) +
|
||||
` }\n`);
|
||||
});
|
||||
}
|
||||
exports.enableExtensionWindows = enableExtensionWindows;
|
||||
/**
|
||||
* Enable extensions which are installed but not enabled on unix
|
||||
*
|
||||
* @param extension
|
||||
* @param os_version
|
||||
*/
|
||||
function enableExtensionUnix(extension, os_version, log_prefix) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return (`if [ ! "$(php -m | grep -i ${extension})" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
||||
echo "${yield utils.getExtensionPrefix(extension)}=${extension}" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'\n` +
|
||||
(yield utils.log('Enabled ' + extension, os_version, 'success', log_prefix)) +
|
||||
`;\n elif [ "$(php -m | grep -i ${extension})" ]; then \n` +
|
||||
(yield utils.log(extension + ' was already enabled', os_version, 'success', log_prefix)) +
|
||||
`; fi\n`);
|
||||
});
|
||||
}
|
||||
exports.enableExtensionUnix = enableExtensionUnix;
|
||||
/**
|
||||
* Install and enable extensions for darwin
|
||||
*
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
*/
|
||||
function addExtensionDarwin(extension_csv, version, log_prefix) {
|
||||
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
|
||||
script += yield enableExtensionUnix(extension, 'darwin', log_prefix);
|
||||
switch (yield pecl.checkPECLExtension(extension)) {
|
||||
case true:
|
||||
let install_command = '';
|
||||
switch (version + extension) {
|
||||
case '7.4xdebug':
|
||||
install_command =
|
||||
'sh ./xdebug_darwin.sh >/dev/null 2>&1 && echo "zend_extension=xdebug.so" >> $ini_file';
|
||||
break;
|
||||
case '7.4pcov':
|
||||
install_command =
|
||||
'sh ./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
||||
break;
|
||||
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 +=
|
||||
'if [ ! "$(php -m | grep -i ' +
|
||||
extension +
|
||||
')" ]; then ' +
|
||||
install_command +
|
||||
' && ' +
|
||||
(yield utils.log('Installed and enabled ' + extension, 'darwin', 'success', log_prefix)) +
|
||||
' || ' +
|
||||
(yield utils.log('Could not install ' + extension + ' on PHP' + version, 'darwin', 'error', log_prefix)) +
|
||||
'; fi\n';
|
||||
break;
|
||||
case false:
|
||||
default:
|
||||
script +=
|
||||
'if [ ! "$(php -m | grep -i ' +
|
||||
extension +
|
||||
')" ]; then \n' +
|
||||
(yield utils.log('Could not find ' + extension + ' for PHP' + version + ' on PECL', 'darwin', 'error', log_prefix)) +
|
||||
'; fi\n';
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
return script;
|
||||
});
|
||||
}
|
||||
exports.addExtensionDarwin = addExtensionDarwin;
|
||||
/**
|
||||
* Install and enable extensions for windows
|
||||
*
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
*/
|
||||
function addExtensionWindows(extension_csv, version, log_prefix) {
|
||||
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
|
||||
script += yield enableExtensionWindows(extension, log_prefix);
|
||||
switch (yield pecl.checkPECLExtension(extension)) {
|
||||
case true:
|
||||
let install_command = '';
|
||||
switch (version + extension) {
|
||||
case '7.4xdebug':
|
||||
const extension_url = 'https://xdebug.org/files/php_xdebug-2.8.0beta2-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 +=
|
||||
'if(!(php -m | findstr -i ' +
|
||||
extension +
|
||||
')) { ' +
|
||||
'try { ' +
|
||||
install_command +
|
||||
'\n' +
|
||||
(yield utils.log('Installed and enabled ' + extension, 'win32', 'success', log_prefix)) +
|
||||
' } catch [Exception] { ' +
|
||||
(yield utils.log('Could not install ' + extension + ' on PHP' + version, 'win32', 'error', log_prefix)) +
|
||||
' } }\n';
|
||||
break;
|
||||
case false:
|
||||
default:
|
||||
script +=
|
||||
'if(!(php -m | findstr -i ' +
|
||||
extension +
|
||||
')) { ' +
|
||||
(yield utils.log('Could not find ' + extension + ' for PHP' + version + ' on PECL', 'win32', 'error', log_prefix)) +
|
||||
' } \n';
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
return script;
|
||||
});
|
||||
}
|
||||
exports.addExtensionWindows = addExtensionWindows;
|
||||
/**
|
||||
* Install and enable extensions for linux
|
||||
*
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
*/
|
||||
function addExtensionLinux(extension_csv, version, log_prefix) {
|
||||
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
|
||||
script += yield enableExtensionUnix(extension, 'linux', log_prefix);
|
||||
let install_command = '';
|
||||
switch (version + extension) {
|
||||
case '7.4xdebug':
|
||||
install_command =
|
||||
'./xdebug.sh >/dev/null 2>&1 && echo "zend_extension=xdebug.so" >> $ini_file';
|
||||
break;
|
||||
case '7.4pcov':
|
||||
install_command =
|
||||
'./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
||||
break;
|
||||
default:
|
||||
install_command =
|
||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
||||
version +
|
||||
'-' +
|
||||
extension +
|
||||
' >/dev/null 2>&1';
|
||||
break;
|
||||
}
|
||||
script +=
|
||||
'if [ ! "$(php -m | grep -i ' +
|
||||
extension +
|
||||
')" ]; then ' +
|
||||
install_command +
|
||||
' && ' +
|
||||
(yield utils.log('Installed and enabled ' + extension, 'linux', 'success', log_prefix)) +
|
||||
' || ' +
|
||||
(yield utils.log('Could not find php' + version + '-' + extension + ' on APT repository', 'linux', 'error', log_prefix)) +
|
||||
'; fi\n';
|
||||
});
|
||||
});
|
||||
return script;
|
||||
});
|
||||
}
|
||||
exports.addExtensionLinux = addExtensionLinux;
|
||||
/**
|
||||
* Add script to set custom ini values for unix
|
||||
*
|
||||
* @param ini_values_csv
|
||||
*/
|
||||
function addINIValuesUnix(ini_values_csv) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let script = '\n';
|
||||
let ini_values = yield utils.INIArray(ini_values_csv);
|
||||
yield utils.asyncForEach(ini_values, function (ini_value) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// add script to set ini value
|
||||
script += 'echo "' + ini_value + '" >> $ini_file\n';
|
||||
});
|
||||
});
|
||||
return script;
|
||||
});
|
||||
}
|
||||
exports.addINIValuesUnix = addINIValuesUnix;
|
||||
/**
|
||||
* Add script to set custom ini values for windows
|
||||
*
|
||||
* @param ini_values_csv
|
||||
*/
|
||||
function addINIValuesWindows(ini_values_csv) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let script = '\n';
|
||||
let ini_values = yield utils.INIArray(ini_values_csv);
|
||||
yield utils.asyncForEach(ini_values, function (ini_value) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// add script to set ini value
|
||||
script += 'Add-Content C:\\tools\\php\\php.ini "' + ini_value + '"\n';
|
||||
});
|
||||
});
|
||||
return script;
|
||||
});
|
||||
}
|
||||
exports.addINIValuesWindows = addINIValuesWindows;
|
||||
function addCoverage(coverage, version, os_version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let script = '';
|
||||
script += '\n';
|
||||
coverage = coverage.toLowerCase();
|
||||
// pcov
|
||||
switch (coverage) {
|
||||
case 'pcov':
|
||||
// if version is 7.1 or newer
|
||||
switch (version) {
|
||||
default:
|
||||
script += yield addExtension('pcov', version, os_version, 'Set Coverage Driver');
|
||||
script += yield addINIValues('pcov.enabled=1', os_version);
|
||||
// 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 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.log('PCOV enabled as coverage driver', os_version, 'success', 'Set Coverage Driver');
|
||||
// version is not supported
|
||||
break;
|
||||
case '5.6':
|
||||
case '7.0':
|
||||
script += yield utils.log('PCOV requires PHP 7.1 or newer', os_version, 'warning', 'Set Coverage Driver');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//xdebug
|
||||
case 'xdebug':
|
||||
script += yield addExtension('xdebug', version, os_version, 'Set Coverage Driver');
|
||||
script += yield utils.log('Xdebug enabled as coverage driver', os_version, 'success', 'Set Coverage Driver');
|
||||
break;
|
||||
// unknown coverage driver
|
||||
default:
|
||||
script = '';
|
||||
}
|
||||
return script;
|
||||
});
|
||||
}
|
||||
exports.addCoverage = addCoverage;
|
@ -1,69 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exec_1 = require("@actions/exec/lib/exec");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const utils = __importStar(require("./utils"));
|
||||
const features = __importStar(require("./features"));
|
||||
/**
|
||||
* Run the script
|
||||
*/
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
// taking inputs
|
||||
let version = yield utils.getInput('php-version', true);
|
||||
let extension_csv = yield utils.getInput('extension-csv', false);
|
||||
let ini_values_csv = yield utils.getInput('ini-values-csv', false);
|
||||
let coverage = yield utils.getInput('coverage', false);
|
||||
let os_version = process.platform;
|
||||
// check the os version and run the respective script
|
||||
if (os_version == 'darwin') {
|
||||
let darwin = yield utils.readScript('darwin.sh', version, os_version);
|
||||
darwin += yield features.addExtension(extension_csv, version, os_version);
|
||||
darwin += yield features.addINIValues(ini_values_csv, os_version);
|
||||
darwin += yield features.addCoverage(coverage, version, os_version);
|
||||
yield utils.writeScript('darwin.sh', version, darwin);
|
||||
yield exec_1.exec('sh ./' + version + 'darwin.sh ' + version);
|
||||
}
|
||||
else if (os_version == 'win32') {
|
||||
let windows = yield utils.readScript('win32.ps1', version, os_version);
|
||||
windows += yield features.addExtension(extension_csv, version, os_version);
|
||||
windows += yield features.addINIValues(ini_values_csv, os_version);
|
||||
windows += yield features.addCoverage(coverage, version, os_version);
|
||||
yield utils.writeScript('win32.ps1', version, windows);
|
||||
yield exec_1.exec('powershell .\\' + version + 'win32.ps1 -version ' + version);
|
||||
}
|
||||
else if (os_version == 'linux') {
|
||||
let linux = yield utils.readScript('linux.sh', version, os_version);
|
||||
linux += yield features.addExtension(extension_csv, version, os_version);
|
||||
linux += yield features.addINIValues(ini_values_csv, os_version);
|
||||
linux += yield features.addCoverage(coverage, version, os_version);
|
||||
yield utils.writeScript('linux.sh', version, linux);
|
||||
yield exec_1.exec('./' + version + 'linux.sh ' + version);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
core.setFailed(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
// call the run function
|
||||
run().then(function () {
|
||||
console.log('done');
|
||||
});
|
35
lib/pecl.js
35
lib/pecl.js
@ -1,35 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const hc = __importStar(require("typed-rest-client/HttpClient"));
|
||||
/**
|
||||
* Function to check if PECL extension exists
|
||||
*
|
||||
* @param extension
|
||||
*/
|
||||
function checkPECLExtension(extension) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const http = new hc.HttpClient('shivammathur/php-setup', [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 2
|
||||
});
|
||||
const response = yield http.get('https://pecl.php.net/package/' + extension);
|
||||
return response.message.statusCode === 200;
|
||||
});
|
||||
}
|
||||
exports.checkPECLExtension = checkPECLExtension;
|
212
lib/utils.js
212
lib/utils.js
@ -1,212 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
function getInput(name, mandatory) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let input = process.env[name];
|
||||
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;
|
||||
/**
|
||||
* Copy config
|
||||
*
|
||||
* @param files
|
||||
*/
|
||||
function readFiles74(files) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield asyncForEach(files, function (filename) {
|
||||
fs.createReadStream(path.join(__dirname, '../src/' + filename)).pipe(fs.createWriteStream(filename.split('/')[1], { mode: 0o755 }));
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.readFiles74 = readFiles74;
|
||||
/**
|
||||
* 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':
|
||||
yield readFiles74([
|
||||
'configs/config.yaml',
|
||||
'scripts/xdebug_darwin.sh',
|
||||
'scripts/pcov.sh'
|
||||
]);
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/7.4.sh'), 'utf8');
|
||||
}
|
||||
break;
|
||||
case 'linux':
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
yield readFiles74(['scripts/xdebug.sh', 'scripts/pcov.sh']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'win32':
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
yield readFiles74(['ext/php_pcov.dll']);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||
}
|
||||
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
|
||||
});
|
||||
}
|
||||
exports.readScript = readScript;
|
||||
/**
|
||||
* Write final script which runs
|
||||
*
|
||||
* @param filename
|
||||
* @param version
|
||||
* @param script
|
||||
*/
|
||||
function writeScript(filename, version, script) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
fs.writeFileSync(version + filename, script, { mode: 0o755 });
|
||||
});
|
||||
}
|
||||
exports.writeScript = writeScript;
|
||||
/**
|
||||
* Function to break extension csv into an array
|
||||
* @param extension_csv
|
||||
*/
|
||||
function extensionArray(extension_csv) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
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 log(message, os_version, log_type, prefix = '') {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unix_color = {
|
||||
error: '31',
|
||||
success: '32',
|
||||
warning: '33'
|
||||
};
|
||||
switch (prefix) {
|
||||
case '':
|
||||
prefix = prefix;
|
||||
break;
|
||||
default:
|
||||
prefix = prefix + ': ';
|
||||
break;
|
||||
}
|
||||
switch (os_version) {
|
||||
case 'win32':
|
||||
const color = {
|
||||
error: 'red',
|
||||
success: 'green',
|
||||
warning: 'yellow'
|
||||
};
|
||||
return ("Write-Host '" +
|
||||
prefix +
|
||||
message +
|
||||
"' -ForegroundColor " +
|
||||
color[log_type]);
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
default:
|
||||
return ('echo "\\033[' +
|
||||
unix_color[log_type] +
|
||||
';1m' +
|
||||
prefix +
|
||||
message +
|
||||
'\\033[0m"');
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.log = log;
|
||||
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;
|
15
node_modules/.bin/semver
generated
vendored
15
node_modules/.bin/semver
generated
vendored
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../semver/bin/semver.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/.bin/semver.cmd
generated
vendored
7
node_modules/.bin/semver.cmd
generated
vendored
@ -1,7 +0,0 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\semver\bin\semver.js" %*
|
||||
)
|
15
node_modules/.bin/uuid
generated
vendored
15
node_modules/.bin/uuid
generated
vendored
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../uuid/bin/uuid" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/.bin/uuid.cmd
generated
vendored
7
node_modules/.bin/uuid.cmd
generated
vendored
@ -1,7 +0,0 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\uuid\bin\uuid" %*
|
||||
)
|
97
node_modules/@actions/core/README.md
generated
vendored
97
node_modules/@actions/core/README.md
generated
vendored
@ -1,97 +0,0 @@
|
||||
# `@actions/core`
|
||||
|
||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||
|
||||
## Usage
|
||||
|
||||
#### Inputs/Outputs
|
||||
|
||||
You can use this library to get inputs or set outputs:
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('inputName', { required: true });
|
||||
|
||||
// Do stuff
|
||||
|
||||
core.setOutput('outputKey', 'outputVal');
|
||||
```
|
||||
|
||||
#### Exporting variables
|
||||
|
||||
You can also export variables for future steps. Variables get set in the environment.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
// Do stuff
|
||||
|
||||
core.exportVariable('envVar', 'Val');
|
||||
```
|
||||
|
||||
#### PATH Manipulation
|
||||
|
||||
You can explicitly add items to the path for all remaining steps in a workflow:
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
core.addPath('pathToTool');
|
||||
```
|
||||
|
||||
#### Exit codes
|
||||
|
||||
You should use this library to set the failing exit code for your action:
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
try {
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
// setFailed logs the message and sets a failing exit code
|
||||
core.setFailed(`Action failed with error ${err}`);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### Logging
|
||||
|
||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('input');
|
||||
try {
|
||||
core.debug('Inside try block');
|
||||
|
||||
if (!myInput) {
|
||||
core.warning('myInput was not set');
|
||||
}
|
||||
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Error ${err}, action may still succeed though`);
|
||||
}
|
||||
```
|
||||
|
||||
This library can also wrap chunks of output in foldable groups.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core')
|
||||
|
||||
// Manually wrap output
|
||||
core.startGroup('Do some function')
|
||||
doSomeFunction()
|
||||
core.endGroup()
|
||||
|
||||
// Wrap an asynchronous function call
|
||||
const result = await core.group('Do something async', async () => {
|
||||
const response = await doSomeHTTPRequest()
|
||||
return response
|
||||
})
|
||||
```
|
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@ -1,16 +0,0 @@
|
||||
interface CommandProperties {
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ##[name key=value;key=value]message
|
||||
*
|
||||
* Examples:
|
||||
* ##[warning]This is the user warning message
|
||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
||||
*/
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
||||
export declare function issue(name: string, message?: string): void;
|
||||
export {};
|
66
node_modules/@actions/core/lib/command.js
generated
vendored
66
node_modules/@actions/core/lib/command.js
generated
vendored
@ -1,66 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = require("os");
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ##[name key=value;key=value]message
|
||||
*
|
||||
* Examples:
|
||||
* ##[warning]This is the user warning message
|
||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
||||
*/
|
||||
function issueCommand(command, properties, message) {
|
||||
const cmd = new Command(command, properties, message);
|
||||
process.stdout.write(cmd.toString() + os.EOL);
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
function issue(name, message = '') {
|
||||
issueCommand(name, {}, message);
|
||||
}
|
||||
exports.issue = issue;
|
||||
const CMD_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
|
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,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"}
|
99
node_modules/@actions/core/lib/core.d.ts
generated
vendored
99
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -1,99 +0,0 @@
|
||||
/**
|
||||
* Interface for getInput options
|
||||
*/
|
||||
export interface InputOptions {
|
||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: string): void;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
*/
|
||||
export declare function exportSecret(name: string, val: string): void;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
export declare function addPath(inputPath: string): void;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store
|
||||
*/
|
||||
export declare function setOutput(name: string, value: string): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
export declare function setFailed(message: string): void;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message
|
||||
*/
|
||||
export declare function error(message: string): void;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
*/
|
||||
export declare function warning(message: string): void;
|
||||
/**
|
||||
* 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>;
|
177
node_modules/@actions/core/lib/core.js
generated
vendored
177
node_modules/@actions/core/lib/core.js
generated
vendored
@ -1,177 +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;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
*/
|
||||
function exportSecret(name, val) {
|
||||
exportVariable(name, val);
|
||||
// the runner will error with not implemented
|
||||
// leaving the function but raising the error earlier
|
||||
command_1.issueCommand('set-secret', {}, val);
|
||||
throw new Error('Not implemented.');
|
||||
}
|
||||
exports.exportSecret = exportSecret;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
function getInput(name, options) {
|
||||
const val = process.env[`INPUT_${name.replace(/ /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;
|
||||
//# sourceMappingURL=core.js.map
|
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,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;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAEzB,6CAA6C;IAC7C,qDAAqD;IACrD,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;AACrC,CAAC;AAPD,oCAOC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,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"}
|
67
node_modules/@actions/core/package.json
generated
vendored
67
node_modules/@actions/core/package.json
generated
vendored
@ -1,67 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/core@1.1.1",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/core@1.1.1",
|
||||
"_id": "@actions/core@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@1.1.1",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz",
|
||||
"_spec": "1.1.1",
|
||||
"_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"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
7
node_modules/@actions/exec/LICENSE.md
generated
vendored
7
node_modules/@actions/exec/LICENSE.md
generated
vendored
@ -1,7 +0,0 @@
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
60
node_modules/@actions/exec/README.md
generated
vendored
60
node_modules/@actions/exec/README.md
generated
vendored
@ -1,60 +0,0 @@
|
||||
# `@actions/exec`
|
||||
|
||||
## Usage
|
||||
|
||||
#### Basic
|
||||
|
||||
You can use this package to execute your tools on the command line in a cross platform way:
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node index.js');
|
||||
```
|
||||
|
||||
#### Args
|
||||
|
||||
You can also pass in arg arrays:
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node', ['index.js', 'foo=bar']);
|
||||
```
|
||||
|
||||
#### Output/options
|
||||
|
||||
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
let myOutput = '';
|
||||
let myError = '';
|
||||
|
||||
const options = {};
|
||||
options.listeners = {
|
||||
stdout: (data: Buffer) => {
|
||||
myOutput += data.toString();
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
myError += data.toString();
|
||||
}
|
||||
};
|
||||
options.cwd = './lib';
|
||||
|
||||
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||
```
|
||||
|
||||
#### Exec tools not in the PATH
|
||||
|
||||
You can use it in conjunction with the `which` function from `@actions/io` to execute tools that are not in the PATH:
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
|
||||
const pythonPath: string = await io.which('python', true)
|
||||
|
||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||
```
|
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
@ -1,12 +0,0 @@
|
||||
import * as im from './interfaces';
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
@ -1,37 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tr = require("./toolrunner");
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
function exec(commandLine, args, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commandArgs = tr.argStringToArray(commandLine);
|
||||
if (commandArgs.length === 0) {
|
||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
||||
}
|
||||
// Path to tool to execute should be first arg
|
||||
const toolPath = commandArgs[0];
|
||||
args = commandArgs.slice(1).concat(args || []);
|
||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
||||
return runner.exec();
|
||||
});
|
||||
}
|
||||
exports.exec = exec;
|
||||
//# sourceMappingURL=exec.js.map
|
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mCAAkC;AAElC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAwB;;QAExB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
@ -1,35 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import * as stream from 'stream';
|
||||
/**
|
||||
* Interface for exec options
|
||||
*/
|
||||
export interface ExecOptions {
|
||||
/** optional working directory. defaults to current */
|
||||
cwd?: string;
|
||||
/** optional envvar dictionary. defaults to current process's env */
|
||||
env?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/** optional. defaults to false */
|
||||
silent?: boolean;
|
||||
/** optional out stream to use. Defaults to process.stdout */
|
||||
outStream?: stream.Writable;
|
||||
/** optional err stream to use. Defaults to process.stderr */
|
||||
errStream?: stream.Writable;
|
||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
||||
windowsVerbatimArguments?: boolean;
|
||||
/** optional. whether to fail if output to stderr. defaults to false */
|
||||
failOnStdErr?: boolean;
|
||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
||||
ignoreReturnCode?: boolean;
|
||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
||||
delay?: number;
|
||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
||||
listeners?: {
|
||||
stdout?: (data: Buffer) => void;
|
||||
stderr?: (data: Buffer) => void;
|
||||
stdline?: (data: string) => void;
|
||||
errline?: (data: string) => void;
|
||||
debug?: (data: string) => void;
|
||||
};
|
||||
}
|
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=interfaces.js.map
|
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
@ -1,37 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import * as events from 'events';
|
||||
import * as im from './interfaces';
|
||||
export declare class ToolRunner extends events.EventEmitter {
|
||||
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
||||
private toolPath;
|
||||
private args;
|
||||
private options;
|
||||
private _debug;
|
||||
private _getCommandString;
|
||||
private _processLineBuffer;
|
||||
private _getSpawnFileName;
|
||||
private _getSpawnArgs;
|
||||
private _endsWith;
|
||||
private _isCmdFile;
|
||||
private _windowsQuoteCmdArg;
|
||||
private _uvQuoteCmdArg;
|
||||
private _cloneExecOptions;
|
||||
private _getSpawnOptions;
|
||||
/**
|
||||
* Exec a tool.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
exec(): Promise<number>;
|
||||
}
|
||||
/**
|
||||
* Convert an arg string to an array of args. Handles escaping
|
||||
*
|
||||
* @param argString string of arguments
|
||||
* @returns string[] array of arguments
|
||||
*/
|
||||
export declare function argStringToArray(argString: string): string[];
|
574
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
574
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
@ -1,574 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = require("os");
|
||||
const events = require("events");
|
||||
const child = require("child_process");
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
/*
|
||||
* Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
|
||||
*/
|
||||
class ToolRunner extends events.EventEmitter {
|
||||
constructor(toolPath, args, options) {
|
||||
super();
|
||||
if (!toolPath) {
|
||||
throw new Error("Parameter 'toolPath' cannot be null or empty.");
|
||||
}
|
||||
this.toolPath = toolPath;
|
||||
this.args = args || [];
|
||||
this.options = options || {};
|
||||
}
|
||||
_debug(message) {
|
||||
if (this.options.listeners && this.options.listeners.debug) {
|
||||
this.options.listeners.debug(message);
|
||||
}
|
||||
}
|
||||
_getCommandString(options, noPrefix) {
|
||||
const toolPath = this._getSpawnFileName();
|
||||
const args = this._getSpawnArgs(options);
|
||||
let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
|
||||
if (IS_WINDOWS) {
|
||||
// Windows + cmd file
|
||||
if (this._isCmdFile()) {
|
||||
cmd += toolPath;
|
||||
for (const a of args) {
|
||||
cmd += ` ${a}`;
|
||||
}
|
||||
}
|
||||
// Windows + verbatim
|
||||
else if (options.windowsVerbatimArguments) {
|
||||
cmd += `"${toolPath}"`;
|
||||
for (const a of args) {
|
||||
cmd += ` ${a}`;
|
||||
}
|
||||
}
|
||||
// Windows (regular)
|
||||
else {
|
||||
cmd += this._windowsQuoteCmdArg(toolPath);
|
||||
for (const a of args) {
|
||||
cmd += ` ${this._windowsQuoteCmdArg(a)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// OSX/Linux - this can likely be improved with some form of quoting.
|
||||
// creating processes on Unix is fundamentally different than Windows.
|
||||
// on Unix, execvp() takes an arg array.
|
||||
cmd += toolPath;
|
||||
for (const a of args) {
|
||||
cmd += ` ${a}`;
|
||||
}
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
_processLineBuffer(data, strBuffer, onLine) {
|
||||
try {
|
||||
let s = strBuffer + data.toString();
|
||||
let n = s.indexOf(os.EOL);
|
||||
while (n > -1) {
|
||||
const line = s.substring(0, n);
|
||||
onLine(line);
|
||||
// the rest of the string ...
|
||||
s = s.substring(n + os.EOL.length);
|
||||
n = s.indexOf(os.EOL);
|
||||
}
|
||||
strBuffer = s;
|
||||
}
|
||||
catch (err) {
|
||||
// streaming lines to console is best effort. Don't fail a build.
|
||||
this._debug(`error processing line. Failed with error ${err}`);
|
||||
}
|
||||
}
|
||||
_getSpawnFileName() {
|
||||
if (IS_WINDOWS) {
|
||||
if (this._isCmdFile()) {
|
||||
return process.env['COMSPEC'] || 'cmd.exe';
|
||||
}
|
||||
}
|
||||
return this.toolPath;
|
||||
}
|
||||
_getSpawnArgs(options) {
|
||||
if (IS_WINDOWS) {
|
||||
if (this._isCmdFile()) {
|
||||
let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
|
||||
for (const a of this.args) {
|
||||
argline += ' ';
|
||||
argline += options.windowsVerbatimArguments
|
||||
? a
|
||||
: this._windowsQuoteCmdArg(a);
|
||||
}
|
||||
argline += '"';
|
||||
return [argline];
|
||||
}
|
||||
}
|
||||
return this.args;
|
||||
}
|
||||
_endsWith(str, end) {
|
||||
return str.endsWith(end);
|
||||
}
|
||||
_isCmdFile() {
|
||||
const upperToolPath = this.toolPath.toUpperCase();
|
||||
return (this._endsWith(upperToolPath, '.CMD') ||
|
||||
this._endsWith(upperToolPath, '.BAT'));
|
||||
}
|
||||
_windowsQuoteCmdArg(arg) {
|
||||
// for .exe, apply the normal quoting rules that libuv applies
|
||||
if (!this._isCmdFile()) {
|
||||
return this._uvQuoteCmdArg(arg);
|
||||
}
|
||||
// otherwise apply quoting rules specific to the cmd.exe command line parser.
|
||||
// the libuv rules are generic and are not designed specifically for cmd.exe
|
||||
// command line parser.
|
||||
//
|
||||
// for a detailed description of the cmd.exe command line parser, refer to
|
||||
// http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
|
||||
// need quotes for empty arg
|
||||
if (!arg) {
|
||||
return '""';
|
||||
}
|
||||
// determine whether the arg needs to be quoted
|
||||
const cmdSpecialChars = [
|
||||
' ',
|
||||
'\t',
|
||||
'&',
|
||||
'(',
|
||||
')',
|
||||
'[',
|
||||
']',
|
||||
'{',
|
||||
'}',
|
||||
'^',
|
||||
'=',
|
||||
';',
|
||||
'!',
|
||||
"'",
|
||||
'+',
|
||||
',',
|
||||
'`',
|
||||
'~',
|
||||
'|',
|
||||
'<',
|
||||
'>',
|
||||
'"'
|
||||
];
|
||||
let needsQuotes = false;
|
||||
for (const char of arg) {
|
||||
if (cmdSpecialChars.some(x => x === char)) {
|
||||
needsQuotes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// short-circuit if quotes not needed
|
||||
if (!needsQuotes) {
|
||||
return arg;
|
||||
}
|
||||
// the following quoting rules are very similar to the rules that by libuv applies.
|
||||
//
|
||||
// 1) wrap the string in quotes
|
||||
//
|
||||
// 2) double-up quotes - i.e. " => ""
|
||||
//
|
||||
// this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
|
||||
// doesn't work well with a cmd.exe command line.
|
||||
//
|
||||
// note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
|
||||
// for example, the command line:
|
||||
// foo.exe "myarg:""my val"""
|
||||
// is parsed by a .NET console app into an arg array:
|
||||
// [ "myarg:\"my val\"" ]
|
||||
// which is the same end result when applying libuv quoting rules. although the actual
|
||||
// command line from libuv quoting rules would look like:
|
||||
// foo.exe "myarg:\"my val\""
|
||||
//
|
||||
// 3) double-up slashes that precede a quote,
|
||||
// e.g. hello \world => "hello \world"
|
||||
// hello\"world => "hello\\""world"
|
||||
// hello\\"world => "hello\\\\""world"
|
||||
// hello world\ => "hello world\\"
|
||||
//
|
||||
// technically this is not required for a cmd.exe command line, or the batch argument parser.
|
||||
// the reasons for including this as a .cmd quoting rule are:
|
||||
//
|
||||
// a) this is optimized for the scenario where the argument is passed from the .cmd file to an
|
||||
// external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
|
||||
//
|
||||
// b) it's what we've been doing previously (by deferring to node default behavior) and we
|
||||
// haven't heard any complaints about that aspect.
|
||||
//
|
||||
// note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
|
||||
// escaped when used on the command line directly - even though within a .cmd file % can be escaped
|
||||
// by using %%.
|
||||
//
|
||||
// the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
|
||||
// the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
|
||||
//
|
||||
// one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
|
||||
// often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
|
||||
// variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
|
||||
// to an external program.
|
||||
//
|
||||
// an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
|
||||
// % can be escaped within a .cmd file.
|
||||
let reverse = '"';
|
||||
let quoteHit = true;
|
||||
for (let i = arg.length; i > 0; i--) {
|
||||
// walk the string in reverse
|
||||
reverse += arg[i - 1];
|
||||
if (quoteHit && arg[i - 1] === '\\') {
|
||||
reverse += '\\'; // double the slash
|
||||
}
|
||||
else if (arg[i - 1] === '"') {
|
||||
quoteHit = true;
|
||||
reverse += '"'; // double the quote
|
||||
}
|
||||
else {
|
||||
quoteHit = false;
|
||||
}
|
||||
}
|
||||
reverse += '"';
|
||||
return reverse
|
||||
.split('')
|
||||
.reverse()
|
||||
.join('');
|
||||
}
|
||||
_uvQuoteCmdArg(arg) {
|
||||
// Tool runner wraps child_process.spawn() and needs to apply the same quoting as
|
||||
// Node in certain cases where the undocumented spawn option windowsVerbatimArguments
|
||||
// is used.
|
||||
//
|
||||
// Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
|
||||
// see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
|
||||
// pasting copyright notice from Node within this function:
|
||||
//
|
||||
// Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
if (!arg) {
|
||||
// Need double quotation for empty argument
|
||||
return '""';
|
||||
}
|
||||
if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
|
||||
// No quotation needed
|
||||
return arg;
|
||||
}
|
||||
if (!arg.includes('"') && !arg.includes('\\')) {
|
||||
// No embedded double quotes or backslashes, so I can just wrap
|
||||
// quote marks around the whole thing.
|
||||
return `"${arg}"`;
|
||||
}
|
||||
// Expected input/output:
|
||||
// input : hello"world
|
||||
// output: "hello\"world"
|
||||
// input : hello""world
|
||||
// output: "hello\"\"world"
|
||||
// input : hello\world
|
||||
// output: hello\world
|
||||
// input : hello\\world
|
||||
// output: hello\\world
|
||||
// input : hello\"world
|
||||
// output: "hello\\\"world"
|
||||
// input : hello\\"world
|
||||
// output: "hello\\\\\"world"
|
||||
// input : hello world\
|
||||
// output: "hello world\\" - note the comment in libuv actually reads "hello world\"
|
||||
// but it appears the comment is wrong, it should be "hello world\\"
|
||||
let reverse = '"';
|
||||
let quoteHit = true;
|
||||
for (let i = arg.length; i > 0; i--) {
|
||||
// walk the string in reverse
|
||||
reverse += arg[i - 1];
|
||||
if (quoteHit && arg[i - 1] === '\\') {
|
||||
reverse += '\\';
|
||||
}
|
||||
else if (arg[i - 1] === '"') {
|
||||
quoteHit = true;
|
||||
reverse += '\\';
|
||||
}
|
||||
else {
|
||||
quoteHit = false;
|
||||
}
|
||||
}
|
||||
reverse += '"';
|
||||
return reverse
|
||||
.split('')
|
||||
.reverse()
|
||||
.join('');
|
||||
}
|
||||
_cloneExecOptions(options) {
|
||||
options = options || {};
|
||||
const result = {
|
||||
cwd: options.cwd || process.cwd(),
|
||||
env: options.env || process.env,
|
||||
silent: options.silent || false,
|
||||
windowsVerbatimArguments: options.windowsVerbatimArguments || false,
|
||||
failOnStdErr: options.failOnStdErr || false,
|
||||
ignoreReturnCode: options.ignoreReturnCode || false,
|
||||
delay: options.delay || 10000
|
||||
};
|
||||
result.outStream = options.outStream || process.stdout;
|
||||
result.errStream = options.errStream || process.stderr;
|
||||
return result;
|
||||
}
|
||||
_getSpawnOptions(options, toolPath) {
|
||||
options = options || {};
|
||||
const result = {};
|
||||
result.cwd = options.cwd;
|
||||
result.env = options.env;
|
||||
result['windowsVerbatimArguments'] =
|
||||
options.windowsVerbatimArguments || this._isCmdFile();
|
||||
if (options.windowsVerbatimArguments) {
|
||||
result.argv0 = `"${toolPath}"`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Exec a tool.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
exec() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._debug(`exec tool: ${this.toolPath}`);
|
||||
this._debug('arguments:');
|
||||
for (const arg of this.args) {
|
||||
this._debug(` ${arg}`);
|
||||
}
|
||||
const optionsNonNull = this._cloneExecOptions(this.options);
|
||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
||||
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
|
||||
}
|
||||
const state = new ExecState(optionsNonNull, this.toolPath);
|
||||
state.on('debug', (message) => {
|
||||
this._debug(message);
|
||||
});
|
||||
const fileName = this._getSpawnFileName();
|
||||
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
||||
const stdbuffer = '';
|
||||
if (cp.stdout) {
|
||||
cp.stdout.on('data', (data) => {
|
||||
if (this.options.listeners && this.options.listeners.stdout) {
|
||||
this.options.listeners.stdout(data);
|
||||
}
|
||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
||||
optionsNonNull.outStream.write(data);
|
||||
}
|
||||
this._processLineBuffer(data, stdbuffer, (line) => {
|
||||
if (this.options.listeners && this.options.listeners.stdline) {
|
||||
this.options.listeners.stdline(line);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const errbuffer = '';
|
||||
if (cp.stderr) {
|
||||
cp.stderr.on('data', (data) => {
|
||||
state.processStderr = true;
|
||||
if (this.options.listeners && this.options.listeners.stderr) {
|
||||
this.options.listeners.stderr(data);
|
||||
}
|
||||
if (!optionsNonNull.silent &&
|
||||
optionsNonNull.errStream &&
|
||||
optionsNonNull.outStream) {
|
||||
const s = optionsNonNull.failOnStdErr
|
||||
? optionsNonNull.errStream
|
||||
: optionsNonNull.outStream;
|
||||
s.write(data);
|
||||
}
|
||||
this._processLineBuffer(data, errbuffer, (line) => {
|
||||
if (this.options.listeners && this.options.listeners.errline) {
|
||||
this.options.listeners.errline(line);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
cp.on('error', (err) => {
|
||||
state.processError = err.message;
|
||||
state.processExited = true;
|
||||
state.processClosed = true;
|
||||
state.CheckComplete();
|
||||
});
|
||||
cp.on('exit', (code) => {
|
||||
state.processExitCode = code;
|
||||
state.processExited = true;
|
||||
this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
|
||||
state.CheckComplete();
|
||||
});
|
||||
cp.on('close', (code) => {
|
||||
state.processExitCode = code;
|
||||
state.processExited = true;
|
||||
state.processClosed = true;
|
||||
this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
|
||||
state.CheckComplete();
|
||||
});
|
||||
state.on('done', (error, exitCode) => {
|
||||
if (stdbuffer.length > 0) {
|
||||
this.emit('stdline', stdbuffer);
|
||||
}
|
||||
if (errbuffer.length > 0) {
|
||||
this.emit('errline', errbuffer);
|
||||
}
|
||||
cp.removeAllListeners();
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
resolve(exitCode);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ToolRunner = ToolRunner;
|
||||
/**
|
||||
* Convert an arg string to an array of args. Handles escaping
|
||||
*
|
||||
* @param argString string of arguments
|
||||
* @returns string[] array of arguments
|
||||
*/
|
||||
function argStringToArray(argString) {
|
||||
const args = [];
|
||||
let inQuotes = false;
|
||||
let escaped = false;
|
||||
let arg = '';
|
||||
function append(c) {
|
||||
// we only escape double quotes.
|
||||
if (escaped && c !== '"') {
|
||||
arg += '\\';
|
||||
}
|
||||
arg += c;
|
||||
escaped = false;
|
||||
}
|
||||
for (let i = 0; i < argString.length; i++) {
|
||||
const c = argString.charAt(i);
|
||||
if (c === '"') {
|
||||
if (!escaped) {
|
||||
inQuotes = !inQuotes;
|
||||
}
|
||||
else {
|
||||
append(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (c === '\\' && escaped) {
|
||||
append(c);
|
||||
continue;
|
||||
}
|
||||
if (c === '\\' && inQuotes) {
|
||||
escaped = true;
|
||||
continue;
|
||||
}
|
||||
if (c === ' ' && !inQuotes) {
|
||||
if (arg.length > 0) {
|
||||
args.push(arg);
|
||||
arg = '';
|
||||
}
|
||||
continue;
|
||||
}
|
||||
append(c);
|
||||
}
|
||||
if (arg.length > 0) {
|
||||
args.push(arg.trim());
|
||||
}
|
||||
return args;
|
||||
}
|
||||
exports.argStringToArray = argStringToArray;
|
||||
class ExecState extends events.EventEmitter {
|
||||
constructor(options, toolPath) {
|
||||
super();
|
||||
this.processClosed = false; // tracks whether the process has exited and stdio is closed
|
||||
this.processError = '';
|
||||
this.processExitCode = 0;
|
||||
this.processExited = false; // tracks whether the process has exited
|
||||
this.processStderr = false; // tracks whether stderr was written to
|
||||
this.delay = 10000; // 10 seconds
|
||||
this.done = false;
|
||||
this.timeout = null;
|
||||
if (!toolPath) {
|
||||
throw new Error('toolPath must not be empty');
|
||||
}
|
||||
this.options = options;
|
||||
this.toolPath = toolPath;
|
||||
if (options.delay) {
|
||||
this.delay = options.delay;
|
||||
}
|
||||
}
|
||||
CheckComplete() {
|
||||
if (this.done) {
|
||||
return;
|
||||
}
|
||||
if (this.processClosed) {
|
||||
this._setResult();
|
||||
}
|
||||
else if (this.processExited) {
|
||||
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this);
|
||||
}
|
||||
}
|
||||
_debug(message) {
|
||||
this.emit('debug', message);
|
||||
}
|
||||
_setResult() {
|
||||
// determine whether there is an error
|
||||
let error;
|
||||
if (this.processExited) {
|
||||
if (this.processError) {
|
||||
error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
|
||||
}
|
||||
else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
|
||||
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
|
||||
}
|
||||
else if (this.processStderr && this.options.failOnStdErr) {
|
||||
error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
|
||||
}
|
||||
}
|
||||
// clear the timeout
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = null;
|
||||
}
|
||||
this.done = true;
|
||||
this.emit('done', error, this.processExitCode);
|
||||
}
|
||||
static HandleTimeout(state) {
|
||||
if (state.done) {
|
||||
return;
|
||||
}
|
||||
if (!state.processClosed && state.processExited) {
|
||||
const message = `The STDIO streams did not close within ${state.delay /
|
||||
1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
|
||||
state._debug(message);
|
||||
}
|
||||
state._setResult();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=toolrunner.js.map
|
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
File diff suppressed because one or more lines are too long
67
node_modules/@actions/exec/package.json
generated
vendored
67
node_modules/@actions/exec/package.json
generated
vendored
@ -1,67 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/exec@1.0.1",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/exec@1.0.1",
|
||||
"_id": "@actions/exec@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ==",
|
||||
"_location": "/@actions/exec",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/exec@1.0.1",
|
||||
"name": "@actions/exec",
|
||||
"escapedName": "@actions%2fexec",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz",
|
||||
"_spec": "1.0.1",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"description": "Actions exec lib",
|
||||
"devDependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/exec.js",
|
||||
"name": "@actions/exec",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
7
node_modules/@actions/io/LICENSE.md
generated
vendored
7
node_modules/@actions/io/LICENSE.md
generated
vendored
@ -1,7 +0,0 @@
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
53
node_modules/@actions/io/README.md
generated
vendored
53
node_modules/@actions/io/README.md
generated
vendored
@ -1,53 +0,0 @@
|
||||
# `@actions/io`
|
||||
|
||||
> Core functions for cli filesystem scenarios
|
||||
|
||||
## Usage
|
||||
|
||||
#### mkdir -p
|
||||
|
||||
Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
|
||||
|
||||
```js
|
||||
const io = require('@actions/io');
|
||||
|
||||
await io.mkdirP('path/to/make');
|
||||
```
|
||||
|
||||
#### cp/mv
|
||||
|
||||
Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
|
||||
|
||||
```js
|
||||
const io = require('@actions/io');
|
||||
|
||||
// Recursive must be true for directories
|
||||
const options = { recursive: true, force: false }
|
||||
|
||||
await io.cp('path/to/directory', 'path/to/dest', options);
|
||||
await io.mv('path/to/file', 'path/to/dest');
|
||||
```
|
||||
|
||||
#### rm -rf
|
||||
|
||||
Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
|
||||
|
||||
```js
|
||||
const io = require('@actions/io');
|
||||
|
||||
await io.rmRF('path/to/directory');
|
||||
await io.rmRF('path/to/file');
|
||||
```
|
||||
|
||||
#### which
|
||||
|
||||
Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
|
||||
const pythonPath: string = await io.which('python', true)
|
||||
|
||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||
```
|
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
@ -1,29 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
|
||||
export declare const IS_WINDOWS: boolean;
|
||||
export declare function exists(fsPath: string): Promise<boolean>;
|
||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
export declare function isRooted(p: string): boolean;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
195
node_modules/@actions/io/lib/io-util.js
generated
vendored
195
node_modules/@actions/io/lib/io-util.js
generated
vendored
@ -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());
|
||||
});
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||
exports.IS_WINDOWS = process.platform === 'win32';
|
||||
function exists(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
exports.exists = exists;
|
||||
function isDirectory(fsPath, useStat = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
||||
return stats.isDirectory();
|
||||
});
|
||||
}
|
||||
exports.isDirectory = isDirectory;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
function isRooted(p) {
|
||||
p = normalizeSeparators(p);
|
||||
if (!p) {
|
||||
throw new Error('isRooted() parameter "p" cannot be empty');
|
||||
}
|
||||
if (exports.IS_WINDOWS) {
|
||||
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
||||
); // e.g. C: or C:\hello
|
||||
}
|
||||
return p.startsWith('/');
|
||||
}
|
||||
exports.isRooted = isRooted;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||
fsPath = path.resolve(fsPath);
|
||||
if (depth >= maxDepth)
|
||||
return exports.mkdir(fsPath);
|
||||
try {
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
catch (err) {
|
||||
switch (err.code) {
|
||||
case 'ENOENT': {
|
||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
let stats;
|
||||
try {
|
||||
stats = yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err2) {
|
||||
throw err;
|
||||
}
|
||||
if (!stats.isDirectory())
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
function tryGetExecutablePath(filePath, extensions) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let stats = undefined;
|
||||
try {
|
||||
// test file exists
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// on Windows, test for valid extension
|
||||
const upperExt = path.extname(filePath).toUpperCase();
|
||||
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
// try each extension
|
||||
const originalFilePath = filePath;
|
||||
for (const extension of extensions) {
|
||||
filePath = originalFilePath + extension;
|
||||
stats = undefined;
|
||||
try {
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// preserve the case of the actual file (since an extension was appended)
|
||||
try {
|
||||
const directory = path.dirname(filePath);
|
||||
const upperName = path.basename(filePath).toUpperCase();
|
||||
for (const actualName of yield exports.readdir(directory)) {
|
||||
if (upperName === actualName.toUpperCase()) {
|
||||
filePath = path.join(directory, actualName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
});
|
||||
}
|
||||
exports.tryGetExecutablePath = tryGetExecutablePath;
|
||||
function normalizeSeparators(p) {
|
||||
p = p || '';
|
||||
if (exports.IS_WINDOWS) {
|
||||
// convert slashes on Windows
|
||||
p = p.replace(/\//g, '\\');
|
||||
// remove redundant slashes
|
||||
return p.replace(/\\\\+/g, '\\');
|
||||
}
|
||||
// remove redundant slashes
|
||||
return p.replace(/\/\/+/g, '/');
|
||||
}
|
||||
// on Mac/Linux, test the execute bit
|
||||
// R W X R W X R W X
|
||||
// 256 128 64 32 16 8 4 2 1
|
||||
function isUnixExecutable(stats) {
|
||||
return ((stats.mode & 1) > 0 ||
|
||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||
}
|
||||
//# sourceMappingURL=io-util.js.map
|
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAYE,qTAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,MAAM,GAAG,CAAA;SACV;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAZD,wBAYC;AAED,SAAsB,WAAW,CAC/B,MAAc,EACd,UAAmB,KAAK;;QAExB,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,YAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;QAChE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAA;IAC5B,CAAC;CAAA;AAND,kCAMC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAS;IAChC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC1B,IAAI,CAAC,CAAC,EAAE;QACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,IAAI,kBAAU,EAAE;QACd,OAAO,CACL,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,8BAA8B;SACxE,CAAA,CAAC,sBAAsB;KACzB;IAED,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AAbD,4BAaC;AAED;;;;;;;;;GASG;AACH,SAAsB,MAAM,CAC1B,MAAc,EACd,WAAmB,IAAI,EACvB,QAAgB,CAAC;;QAEjB,WAAE,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAA;QAE9C,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE7B,IAAI,KAAK,IAAI,QAAQ;YAAE,OAAO,aAAK,CAAC,MAAM,CAAC,CAAA;QAE3C,IAAI;YACF,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;YACnB,OAAM;SACP;QAAC,OAAO,GAAG,EAAE;YACZ,QAAQ,GAAG,CAAC,IAAI,EAAE;gBAChB,KAAK,QAAQ,CAAC,CAAC;oBACb,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;oBACvD,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;oBACnB,OAAM;iBACP;gBACD,OAAO,CAAC,CAAC;oBACP,IAAI,KAAe,CAAA;oBAEnB,IAAI;wBACF,KAAK,GAAG,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;qBAC3B;oBAAC,OAAO,IAAI,EAAE;wBACb,MAAM,GAAG,CAAA;qBACV;oBAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;wBAAE,MAAM,GAAG,CAAA;iBACpC;aACF;SACF;IACH,CAAC;CAAA;AAlCD,wBAkCC;AAED;;;;;GAKG;AACH,SAAsB,oBAAoB,CACxC,QAAgB,EAChB,UAAoB;;QAEpB,IAAI,KAAK,GAAyB,SAAS,CAAA;QAC3C,IAAI;YACF,mBAAmB;YACnB,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;SAC7B;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;aACF;SACF;QACD,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;YAC3B,IAAI,kBAAU,EAAE;gBACd,uCAAuC;gBACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;gBACrD,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,EAAE;oBACpE,OAAO,QAAQ,CAAA;iBAChB;aACF;iBAAM;gBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;oBAC3B,OAAO,QAAQ,CAAA;iBAChB;aACF;SACF;QAED,qBAAqB;QACrB,MAAM,gBAAgB,GAAG,QAAQ,CAAA;QACjC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAAA;YAEvC,KAAK,GAAG,SAAS,CAAA;YACjB,IAAI;gBACF,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;aAC7B;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACzB,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;iBACF;aACF;YAED,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;gBAC3B,IAAI,kBAAU,EAAE;oBACd,yEAAyE;oBACzE,IAAI;wBACF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBACxC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;wBACvD,KAAK,MAAM,UAAU,IAAI,MAAM,eAAO,CAAC,SAAS,CAAC,EAAE;4BACjD,IAAI,SAAS,KAAK,UAAU,CAAC,WAAW,EAAE,EAAE;gCAC1C,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;gCAC3C,MAAK;6BACN;yBACF;qBACF;oBAAC,OAAO,GAAG,EAAE;wBACZ,sCAAsC;wBACtC,OAAO,CAAC,GAAG,CACT,yEAAyE,QAAQ,MAAM,GAAG,EAAE,CAC7F,CAAA;qBACF;oBAED,OAAO,QAAQ,CAAA;iBAChB;qBAAM;oBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;wBAC3B,OAAO,QAAQ,CAAA;qBAChB;iBACF;aACF;SACF;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA;AA5ED,oDA4EC;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACX,IAAI,kBAAU,EAAE;QACd,6BAA6B;QAC7B,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"}
|
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface CopyOptions {
|
||||
/** Optional. Whether to recursively copy all subdirectories. Defaults to false */
|
||||
recursive?: boolean;
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface MoveOptions {
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
export declare function mv(source: string, dest: string, options?: MoveOptions): Promise<void>;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
export declare function rmRF(inputPath: string): Promise<void>;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string): Promise<void>;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
export declare function which(tool: string, check?: boolean): Promise<string>;
|
290
node_modules/@actions/io/lib/io.js
generated
vendored
290
node_modules/@actions/io/lib/io.js
generated
vendored
@ -1,290 +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 childProcess = require("child_process");
|
||||
const path = require("path");
|
||||
const util_1 = require("util");
|
||||
const ioUtil = require("./io-util");
|
||||
const exec = util_1.promisify(childProcess.exec);
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
function cp(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { force, recursive } = readCopyOptions(options);
|
||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||
// Dest is an existing file, but not forcing
|
||||
if (destStat && destStat.isFile() && !force) {
|
||||
return;
|
||||
}
|
||||
// If dest is an existing directory, should copy inside.
|
||||
const newDest = destStat && destStat.isDirectory()
|
||||
? path.join(dest, path.basename(source))
|
||||
: dest;
|
||||
if (!(yield ioUtil.exists(source))) {
|
||||
throw new Error(`no such file or directory: ${source}`);
|
||||
}
|
||||
const sourceStat = yield ioUtil.stat(source);
|
||||
if (sourceStat.isDirectory()) {
|
||||
if (!recursive) {
|
||||
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
||||
}
|
||||
else {
|
||||
yield cpDirRecursive(source, newDest, 0, force);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (path.relative(source, newDest) === '') {
|
||||
// a file cannot be copied to itself
|
||||
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
||||
}
|
||||
yield copyFile(source, newDest, force);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.cp = cp;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
function mv(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
let destExists = true;
|
||||
if (yield ioUtil.isDirectory(dest)) {
|
||||
// If dest is directory copy src into dest
|
||||
dest = path.join(dest, path.basename(source));
|
||||
destExists = yield ioUtil.exists(dest);
|
||||
}
|
||||
if (destExists) {
|
||||
if (options.force == null || options.force) {
|
||||
yield rmRF(dest);
|
||||
}
|
||||
else {
|
||||
throw new Error('Destination already exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
yield mkdirP(path.dirname(dest));
|
||||
yield ioUtil.rename(source, dest);
|
||||
});
|
||||
}
|
||||
exports.mv = mv;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
function rmRF(inputPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||
try {
|
||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||
yield exec(`rd /s /q "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield exec(`del /f /a "${inputPath}"`);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||
try {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
else {
|
||||
let isDir = false;
|
||||
try {
|
||||
isDir = yield ioUtil.isDirectory(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
return;
|
||||
}
|
||||
if (isDir) {
|
||||
yield exec(`rm -rf "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.rmRF = rmRF;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
function mkdirP(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield ioUtil.mkdirP(fsPath);
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
function which(tool, check) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!tool) {
|
||||
throw new Error("parameter 'tool' is required");
|
||||
}
|
||||
// recursive when check=true
|
||||
if (check) {
|
||||
const result = yield which(tool, false);
|
||||
if (!result) {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
// build the list of extensions to try
|
||||
const extensions = [];
|
||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
||||
if (extension) {
|
||||
extensions.push(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if it's rooted, return it if exists. otherwise return empty.
|
||||
if (ioUtil.isRooted(tool)) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// if any path separators, return empty
|
||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
||||
return '';
|
||||
}
|
||||
// build the list of directories
|
||||
//
|
||||
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
|
||||
// it feels like we should not do this. Checking the current directory seems like more of a use
|
||||
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
|
||||
// across platforms.
|
||||
const directories = [];
|
||||
if (process.env.PATH) {
|
||||
for (const p of process.env.PATH.split(path.delimiter)) {
|
||||
if (p) {
|
||||
directories.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
// return the first match
|
||||
for (const directory of directories) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`which failed with message ${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.which = which;
|
||||
function readCopyOptions(options) {
|
||||
const force = options.force == null ? true : options.force;
|
||||
const recursive = Boolean(options.recursive);
|
||||
return { force, recursive };
|
||||
}
|
||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Ensure there is not a run away recursive copy
|
||||
if (currentDepth >= 255)
|
||||
return;
|
||||
currentDepth++;
|
||||
yield mkdirP(destDir);
|
||||
const files = yield ioUtil.readdir(sourceDir);
|
||||
for (const fileName of files) {
|
||||
const srcFile = `${sourceDir}/${fileName}`;
|
||||
const destFile = `${destDir}/${fileName}`;
|
||||
const srcFileStat = yield ioUtil.lstat(srcFile);
|
||||
if (srcFileStat.isDirectory()) {
|
||||
// Recurse
|
||||
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
||||
}
|
||||
else {
|
||||
yield copyFile(srcFile, destFile, force);
|
||||
}
|
||||
}
|
||||
// Change the mode for the newly created directory
|
||||
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
||||
});
|
||||
}
|
||||
// Buffered file copy
|
||||
function copyFile(srcFile, destFile, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
||||
// unlink/re-link it
|
||||
try {
|
||||
yield ioUtil.lstat(destFile);
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
catch (e) {
|
||||
// Try to override file permission
|
||||
if (e.code === 'EPERM') {
|
||||
yield ioUtil.chmod(destFile, '0666');
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
// other errors = it doesn't exist, no work to do
|
||||
}
|
||||
// Copy over symlink
|
||||
const symlinkFull = yield ioUtil.readlink(srcFile);
|
||||
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
||||
}
|
||||
else if (!(yield ioUtil.exists(destFile)) || force) {
|
||||
yield ioUtil.copyFile(srcFile, destFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=io.js.map
|
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
File diff suppressed because one or more lines are too long
64
node_modules/@actions/io/package.json
generated
vendored
64
node_modules/@actions/io/package.json
generated
vendored
@ -1,64 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/io@1.0.1",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/io@1.0.1",
|
||||
"_id": "@actions/io@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-rhq+tfZukbtaus7xyUtwKfuiCRXd1hWSfmJNEpFgBQJ4woqPEpsBw04awicjwz9tyG2/MVhAEMfVn664Cri5zA==",
|
||||
"_location": "/@actions/io",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/io@1.0.1",
|
||||
"name": "@actions/io",
|
||||
"escapedName": "@actions%2fio",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.1.tgz",
|
||||
"_spec": "1.0.1",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"description": "Actions io lib",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"io"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/io.js",
|
||||
"name": "@actions/io",
|
||||
"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"
|
||||
}
|
82
node_modules/@actions/tool-cache/README.md
generated
vendored
82
node_modules/@actions/tool-cache/README.md
generated
vendored
@ -1,82 +0,0 @@
|
||||
# `@actions/tool-cache`
|
||||
|
||||
> Functions necessary for downloading and caching tools.
|
||||
|
||||
## Usage
|
||||
|
||||
#### Download
|
||||
|
||||
You can use this to download tools (or other files) from a download URL:
|
||||
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
```
|
||||
|
||||
#### Extract
|
||||
|
||||
These can then be extracted in platform specific ways:
|
||||
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
|
||||
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
|
||||
|
||||
// Or alternately
|
||||
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
|
||||
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
|
||||
}
|
||||
else {
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||
}
|
||||
```
|
||||
|
||||
#### Cache
|
||||
|
||||
Finally, you can cache these directories in our tool-cache. This is useful if you want to switch back and forth between versions of a tool, or save a tool between runs for private runners (private runners are still in development but are on the roadmap).
|
||||
|
||||
You'll often want to add it to the path as part of this step:
|
||||
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
const core = require('@actions/core');
|
||||
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||
|
||||
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
|
||||
core.addPath(cachedPath);
|
||||
```
|
||||
|
||||
You can also cache files for reuse.
|
||||
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
tc.cacheFile('path/to/exe', 'destFileName.exe', 'myExeName', '1.1.0');
|
||||
```
|
||||
|
||||
#### Find
|
||||
|
||||
Finally, you can find directories and files you've previously cached:
|
||||
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
const core = require('@actions/core');
|
||||
|
||||
const nodeDirectory = tc.find('node', '12.x', 'x64');
|
||||
core.addPath(nodeDirectory);
|
||||
```
|
||||
|
||||
You can even find all cached versions of a tool:
|
||||
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
const allNodeVersions = tc.findAllVersions('node');
|
||||
console.log(`Versions of node available: ${allNodeVersions}`);
|
||||
```
|
79
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
79
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
@ -1,79 +0,0 @@
|
||||
export declare class HTTPError extends Error {
|
||||
readonly httpStatusCode: number | undefined;
|
||||
constructor(httpStatusCode: number | undefined);
|
||||
}
|
||||
/**
|
||||
* Download a tool from an url and stream it into a file
|
||||
*
|
||||
* @param url url of tool to download
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
export declare function downloadTool(url: string): Promise<string>;
|
||||
/**
|
||||
* Extract a .7z file
|
||||
*
|
||||
* @param file path to the .7z file
|
||||
* @param dest destination directory. Optional.
|
||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||
* to 7zr.exe can be pass to this function.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extract7z(file: string, dest?: string, _7zPath?: string): Promise<string>;
|
||||
/**
|
||||
* Extract a tar
|
||||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @param flags flags for the tar. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractTar(file: string, dest?: string, flags?: string): Promise<string>;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
* @param file path to the zip
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export declare function extractZip(file: string, dest?: string): Promise<string>;
|
||||
/**
|
||||
* Caches a directory and installs it into the tool cacheDir
|
||||
*
|
||||
* @param sourceDir the directory to cache into tools
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
export declare function cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||
/**
|
||||
* Caches a downloaded file (GUID) and installs it
|
||||
* into the tool cache with a given targetName
|
||||
*
|
||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||
* @param targetFile the name of the file name in the tools directory
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||
/**
|
||||
* Finds the path to a tool version in the local installed tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param versionSpec version of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
|
||||
/**
|
||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
export declare function findAllVersions(toolName: string, arch?: string): string[];
|
438
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
438
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
@ -1,438 +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 core = require("@actions/core");
|
||||
const io = require("@actions/io");
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const httpm = require("typed-rest-client/HttpClient");
|
||||
const semver = require("semver");
|
||||
const uuidV4 = require("uuid/v4");
|
||||
const exec_1 = require("@actions/exec/lib/exec");
|
||||
const assert_1 = require("assert");
|
||||
class HTTPError extends Error {
|
||||
constructor(httpStatusCode) {
|
||||
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
||||
this.httpStatusCode = httpStatusCode;
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
}
|
||||
}
|
||||
exports.HTTPError = HTTPError;
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const userAgent = 'actions/tool-cache';
|
||||
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
let cacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
|
||||
// If directories not found, place them in common temp locations
|
||||
if (!tempDirectory || !cacheRoot) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
// On windows use the USERPROFILE env variable
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
if (!tempDirectory) {
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
if (!cacheRoot) {
|
||||
cacheRoot = path.join(baseLocation, 'actions', 'cache');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Download a tool from an url and stream it into a file
|
||||
*
|
||||
* @param url url of tool to download
|
||||
* @returns path to downloaded tool
|
||||
*/
|
||||
function downloadTool(url) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Wrap in a promise so that we can resolve from within stream callbacks
|
||||
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const http = new httpm.HttpClient(userAgent, [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
const destPath = path.join(tempDirectory, uuidV4());
|
||||
yield io.mkdirP(tempDirectory);
|
||||
core.debug(`Downloading ${url}`);
|
||||
core.debug(`Downloading ${destPath}`);
|
||||
if (fs.existsSync(destPath)) {
|
||||
throw new Error(`Destination file path ${destPath} already exists`);
|
||||
}
|
||||
const response = yield http.get(url);
|
||||
if (response.message.statusCode !== 200) {
|
||||
const err = new HTTPError(response.message.statusCode);
|
||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||
throw err;
|
||||
}
|
||||
const file = fs.createWriteStream(destPath);
|
||||
file.on('open', () => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const stream = response.message.pipe(file);
|
||||
stream.on('close', () => {
|
||||
core.debug('download complete');
|
||||
resolve(destPath);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
file.on('error', err => {
|
||||
file.end();
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
exports.downloadTool = downloadTool;
|
||||
/**
|
||||
* Extract a .7z file
|
||||
*
|
||||
* @param file path to the .7z file
|
||||
* @param dest destination directory. Optional.
|
||||
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||
* to 7zr.exe can be pass to this function.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extract7z(file, dest, _7zPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
||||
assert_1.ok(file, 'parameter "file" is required');
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const originalCwd = process.cwd();
|
||||
process.chdir(dest);
|
||||
if (_7zPath) {
|
||||
try {
|
||||
const args = [
|
||||
'x',
|
||||
'-bb1',
|
||||
'-bd',
|
||||
'-sccUTF-8',
|
||||
file
|
||||
];
|
||||
const options = {
|
||||
silent: true
|
||||
};
|
||||
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
||||
}
|
||||
finally {
|
||||
process.chdir(originalCwd);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const escapedScript = path
|
||||
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
||||
.replace(/'/g, "''")
|
||||
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
];
|
||||
const options = {
|
||||
silent: true
|
||||
};
|
||||
try {
|
||||
const powershellPath = yield io.which('powershell', true);
|
||||
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
||||
}
|
||||
finally {
|
||||
process.chdir(originalCwd);
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extract7z = extract7z;
|
||||
/**
|
||||
* Extract a tar
|
||||
*
|
||||
* @param file path to the tar
|
||||
* @param dest destination directory. Optional.
|
||||
* @param flags flags for the tar. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractTar(file, dest, flags = 'xz') {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
const tarPath = yield io.which('tar', true);
|
||||
yield exec_1.exec(`"${tarPath}"`, [flags, '-C', dest, '-f', file]);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractTar = extractTar;
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
* @param file path to the zip
|
||||
* @param dest destination directory. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
function extractZip(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required");
|
||||
}
|
||||
dest = dest || (yield _createExtractFolder(dest));
|
||||
if (IS_WINDOWS) {
|
||||
yield extractZipWin(file, dest);
|
||||
}
|
||||
else {
|
||||
yield extractZipNix(file, dest);
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
exports.extractZip = extractZip;
|
||||
function extractZipWin(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// build the powershell command
|
||||
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
||||
// run powershell
|
||||
const powershellPath = yield io.which('powershell');
|
||||
const args = [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
];
|
||||
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||
});
|
||||
}
|
||||
function extractZipNix(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = yield io.which('unzip');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Caches a directory and installs it into the tool cacheDir
|
||||
*
|
||||
* @param sourceDir the directory to cache into tools
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
function cacheDir(sourceDir, tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
version = semver.clean(version) || version;
|
||||
arch = arch || os.arch();
|
||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||
core.debug(`source dir: ${sourceDir}`);
|
||||
if (!fs.statSync(sourceDir).isDirectory()) {
|
||||
throw new Error('sourceDir is not a directory');
|
||||
}
|
||||
// Create the tool dir
|
||||
const destPath = yield _createToolPath(tool, version, arch);
|
||||
// copy each child item. do not move. move can fail on Windows
|
||||
// due to anti-virus software having an open handle on a file.
|
||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||
const s = path.join(sourceDir, itemName);
|
||||
yield io.cp(s, destPath, { recursive: true });
|
||||
}
|
||||
// write .complete
|
||||
_completeToolPath(tool, version, arch);
|
||||
return destPath;
|
||||
});
|
||||
}
|
||||
exports.cacheDir = cacheDir;
|
||||
/**
|
||||
* Caches a downloaded file (GUID) and installs it
|
||||
* into the tool cache with a given targetName
|
||||
*
|
||||
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||
* @param targetFile the name of the file name in the tools directory
|
||||
* @param tool tool name
|
||||
* @param version version of the tool. semver format
|
||||
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||
*/
|
||||
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
version = semver.clean(version) || version;
|
||||
arch = arch || os.arch();
|
||||
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||
core.debug(`source file: ${sourceFile}`);
|
||||
if (!fs.statSync(sourceFile).isFile()) {
|
||||
throw new Error('sourceFile is not a file');
|
||||
}
|
||||
// create the tool dir
|
||||
const destFolder = yield _createToolPath(tool, version, arch);
|
||||
// copy instead of move. move can fail on Windows due to
|
||||
// anti-virus software having an open handle on a file.
|
||||
const destPath = path.join(destFolder, targetFile);
|
||||
core.debug(`destination file ${destPath}`);
|
||||
yield io.cp(sourceFile, destPath);
|
||||
// write .complete
|
||||
_completeToolPath(tool, version, arch);
|
||||
return destFolder;
|
||||
});
|
||||
}
|
||||
exports.cacheFile = cacheFile;
|
||||
/**
|
||||
* Finds the path to a tool version in the local installed tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param versionSpec version of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
function find(toolName, versionSpec, arch) {
|
||||
if (!toolName) {
|
||||
throw new Error('toolName parameter is required');
|
||||
}
|
||||
if (!versionSpec) {
|
||||
throw new Error('versionSpec parameter is required');
|
||||
}
|
||||
arch = arch || os.arch();
|
||||
// attempt to resolve an explicit version
|
||||
if (!_isExplicitVersion(versionSpec)) {
|
||||
const localVersions = findAllVersions(toolName, arch);
|
||||
const match = _evaluateVersions(localVersions, versionSpec);
|
||||
versionSpec = match;
|
||||
}
|
||||
// check for the explicit version in the cache
|
||||
let toolPath = '';
|
||||
if (versionSpec) {
|
||||
versionSpec = semver.clean(versionSpec) || '';
|
||||
const cachePath = path.join(cacheRoot, toolName, versionSpec, arch);
|
||||
core.debug(`checking cache: ${cachePath}`);
|
||||
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
||||
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
||||
toolPath = cachePath;
|
||||
}
|
||||
else {
|
||||
core.debug('not found');
|
||||
}
|
||||
}
|
||||
return toolPath;
|
||||
}
|
||||
exports.find = find;
|
||||
/**
|
||||
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||
*
|
||||
* @param toolName name of the tool
|
||||
* @param arch optional arch. defaults to arch of computer
|
||||
*/
|
||||
function findAllVersions(toolName, arch) {
|
||||
const versions = [];
|
||||
arch = arch || os.arch();
|
||||
const toolPath = path.join(cacheRoot, toolName);
|
||||
if (fs.existsSync(toolPath)) {
|
||||
const children = fs.readdirSync(toolPath);
|
||||
for (const child of children) {
|
||||
if (_isExplicitVersion(child)) {
|
||||
const fullPath = path.join(toolPath, child, arch || '');
|
||||
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||
versions.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return versions;
|
||||
}
|
||||
exports.findAllVersions = findAllVersions;
|
||||
function _createExtractFolder(dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!dest) {
|
||||
// create a temp dir
|
||||
dest = path.join(tempDirectory, uuidV4());
|
||||
}
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
function _createToolPath(tool, version, arch) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||
core.debug(`destination ${folderPath}`);
|
||||
const markerPath = `${folderPath}.complete`;
|
||||
yield io.rmRF(folderPath);
|
||||
yield io.rmRF(markerPath);
|
||||
yield io.mkdirP(folderPath);
|
||||
return folderPath;
|
||||
});
|
||||
}
|
||||
function _completeToolPath(tool, version, arch) {
|
||||
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||
const markerPath = `${folderPath}.complete`;
|
||||
fs.writeFileSync(markerPath, '');
|
||||
core.debug('finished caching tool');
|
||||
}
|
||||
function _isExplicitVersion(versionSpec) {
|
||||
const c = semver.clean(versionSpec) || '';
|
||||
core.debug(`isExplicit: ${c}`);
|
||||
const valid = semver.valid(c) != null;
|
||||
core.debug(`explicit? ${valid}`);
|
||||
return valid;
|
||||
}
|
||||
function _evaluateVersions(versions, versionSpec) {
|
||||
let version = '';
|
||||
core.debug(`evaluating ${versions.length} versions`);
|
||||
versions = versions.sort((a, b) => {
|
||||
if (semver.gt(a, b)) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
});
|
||||
for (let i = versions.length - 1; i >= 0; i--) {
|
||||
const potential = versions[i];
|
||||
const satisfied = semver.satisfies(potential, versionSpec);
|
||||
if (satisfied) {
|
||||
version = potential;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (version) {
|
||||
core.debug(`matched: ${version}`);
|
||||
}
|
||||
else {
|
||||
core.debug('match not found');
|
||||
}
|
||||
return version;
|
||||
}
|
||||
//# sourceMappingURL=tool-cache.js.map
|
1
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
1
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
File diff suppressed because one or more lines are too long
78
node_modules/@actions/tool-cache/package.json
generated
vendored
78
node_modules/@actions/tool-cache/package.json
generated
vendored
@ -1,78 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/tool-cache@1.1.2",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/tool-cache@1.1.2",
|
||||
"_id": "@actions/tool-cache@1.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-IJczPaZr02ECa3Lgws/TJEVco9tjOujiQSZbO3dHuXXjhd5vrUtfOgGwhmz3/f97L910OraPZ8SknofUk6RvOQ==",
|
||||
"_location": "/@actions/tool-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/tool-cache@1.1.2",
|
||||
"name": "@actions/tool-cache",
|
||||
"escapedName": "@actions%2ftool-cache",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.2.tgz",
|
||||
"_spec": "1.1.2",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"description": "Actions tool-cache lib",
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"nock": "^10.0.6"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"scripts"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/tool-cache.js",
|
||||
"name": "@actions/tool-cache",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "1.1.2"
|
||||
}
|
60
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
60
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
@ -1,60 +0,0 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Source,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Target)
|
||||
|
||||
# This script translates the output from 7zdec into UTF8. Node has limited
|
||||
# built-in support for encodings.
|
||||
#
|
||||
# 7zdec uses the system default code page. The system default code page varies
|
||||
# depending on the locale configuration. On an en-US box, the system default code
|
||||
# page is Windows-1252.
|
||||
#
|
||||
# Note, on a typical en-US box, testing with the 'ç' character is a good way to
|
||||
# determine whether data is passed correctly between processes. This is because
|
||||
# the 'ç' character has a different code point across each of the common encodings
|
||||
# on a typical en-US box, i.e.
|
||||
# 1) the default console-output code page (IBM437)
|
||||
# 2) the system default code page (i.e. CP_ACP) (Windows-1252)
|
||||
# 3) UTF8
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Redefine the wrapper over STDOUT to use UTF8. Node expects UTF8 by default.
|
||||
$stdout = [System.Console]::OpenStandardOutput()
|
||||
$utf8 = New-Object System.Text.UTF8Encoding($false) # do not emit BOM
|
||||
$writer = New-Object System.IO.StreamWriter($stdout, $utf8)
|
||||
[System.Console]::SetOut($writer)
|
||||
|
||||
# All subsequent output must be written using [System.Console]::WriteLine(). In
|
||||
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.
|
||||
|
||||
Set-Location -LiteralPath $Target
|
||||
|
||||
# Print the ##command.
|
||||
$_7zdec = Join-Path -Path "$PSScriptRoot" -ChildPath "externals/7zdec.exe"
|
||||
[System.Console]::WriteLine("##[command]$_7zdec x `"$Source`"")
|
||||
|
||||
# The $OutputEncoding variable instructs PowerShell how to interpret the output
|
||||
# from the external command.
|
||||
$OutputEncoding = [System.Text.Encoding]::Default
|
||||
|
||||
# Note, the output from 7zdec.exe needs to be iterated over. Otherwise PowerShell.exe
|
||||
# will launch the external command in such a way that it inherits the streams.
|
||||
& $_7zdec x $Source 2>&1 |
|
||||
ForEach-Object {
|
||||
if ($_ -is [System.Management.Automation.ErrorRecord]) {
|
||||
[System.Console]::WriteLine($_.Exception.Message)
|
||||
}
|
||||
else {
|
||||
[System.Console]::WriteLine($_)
|
||||
}
|
||||
}
|
||||
[System.Console]::WriteLine("##[debug]7zdec.exe exit code '$LASTEXITCODE'")
|
||||
[System.Console]::Out.Flush()
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
BIN
node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
generated
vendored
BIN
node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
generated
vendored
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user