Skip to content

Commit 47d1da0

Browse files
authored
Merge pull request #68 from shivammathur/develop
1.4.6
2 parents cb5e07b + dfabf8c commit 47d1da0

File tree

172 files changed

+511
-12478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+511
-12478
lines changed

.github/workflows/workflow.yml .github/workflows/darwin.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Main workflow
1+
name: Darwin workflow
22
on: [push, pull_request]
33
jobs:
44
run:
@@ -8,7 +8,7 @@ jobs:
88
fail-fast: false
99
max-parallel: 15
1010
matrix:
11-
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
11+
operating-system: [macOS-latest]
1212
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
1313
steps:
1414
- name: Checkout

.github/workflows/ubuntu.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Ubuntu workflow
2+
on: [push, pull_request]
3+
jobs:
4+
run:
5+
name: Run
6+
runs-on: ${{ matrix.operating-system }}
7+
strategy:
8+
fail-fast: false
9+
max-parallel: 15
10+
matrix:
11+
operating-system: [ubuntu-latest]
12+
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@master
16+
with:
17+
fetch-depth: 1
18+
19+
- name: Setup Node.js 12.x
20+
uses: actions/setup-node@master
21+
with:
22+
node-version: 12.x
23+
24+
- name: Installing NPM packages
25+
run: npm install
26+
27+
- name: Run tests
28+
run: npm test
29+
30+
- name: Send Coverage
31+
continue-on-error: true
32+
timeout-minutes: 2
33+
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
34+
35+
- name: Setup PHP with extensions and custom config
36+
run: node lib/install.js
37+
env:
38+
php-version: ${{ matrix.php-versions }}
39+
extension-csv: mbstring, xdebug, pcov #optional
40+
ini-values-csv: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional
41+
42+
- name: Testing PHP version
43+
run: php -v
44+
- name: Testing Composer version
45+
run: composer -V
46+
- name: Testing Extensions
47+
run: php -m
48+
- name: Testing ini values
49+
run: |
50+
printf "post_max_size: %s\n" $(php -r "echo ini_get('post_max_size');")
51+
printf "short_open_tag: %s\n" $(php -r "echo ini_get('short_open_tag');")
52+
printf "date.timezone: %s\n" $(php -r "echo ini_get('date.timezone');")

.github/workflows/windows.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Windows workflow
2+
on: [push, pull_request]
3+
jobs:
4+
run:
5+
name: Run
6+
runs-on: ${{ matrix.operating-system }}
7+
strategy:
8+
fail-fast: false
9+
max-parallel: 15
10+
matrix:
11+
operating-system: [windows-latest]
12+
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@master
16+
with:
17+
fetch-depth: 1
18+
19+
- name: Setup Node.js 12.x
20+
uses: actions/setup-node@master
21+
with:
22+
node-version: 12.x
23+
24+
- name: Installing NPM packages
25+
run: npm install
26+
27+
- name: Run tests
28+
run: npm test
29+
30+
- name: Send Coverage
31+
continue-on-error: true
32+
timeout-minutes: 2
33+
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
34+
35+
- name: Setup PHP with extensions and custom config
36+
run: node lib/install.js
37+
env:
38+
php-version: ${{ matrix.php-versions }}
39+
extension-csv: mbstring, xdebug, pcov #optional
40+
ini-values-csv: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional
41+
42+
- name: Testing PHP version
43+
run: php -v
44+
- name: Testing Composer version
45+
run: composer -V
46+
- name: Testing Extensions
47+
run: php -m
48+
- name: Testing ini values
49+
run: |
50+
printf "post_max_size: %s\n" $(php -r "echo ini_get('post_max_size');")
51+
printf "short_open_tag: %s\n" $(php -r "echo ini_get('short_open_tag');")
52+
printf "date.timezone: %s\n" $(php -r "echo ini_get('date.timezone');")

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Setup PHP with required extensions, php.ini configuration and composer in [GitHu
2626
|7.1|`Stable`|`Security fixes only`|
2727
|7.2|`Stable`|`Active`|
2828
|7.3|`Stable`|`Active`|
29-
|7.4|`RC4`|`Active`|
29+
|7.4|`RC4`/`RC5`|`Active`|
3030

3131
**Note:** PHP 7.4 is currently in development, do not use in production/release branches.
3232

__tests__/extensions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Extension tests', () => {
1111
expect(win32).toContain('Install-PhpExtension pcov');
1212
win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32');
1313
const extension_url: string =
14-
'https://xdebug.org/files/php_xdebug-2.8.0beta2-7.4-vc15.dll';
14+
'https://xdebug.org/files/php_xdebug-2.8.0-7.4-vc15.dll';
1515
expect(win32).toContain(
1616
'Invoke-WebRequest -Uri ' +
1717
extension_url +

__tests__/install.test.ts

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import * as install from '../src/install';
2+
3+
/**
4+
* Mock install.ts
5+
*/
6+
jest.mock('../src/install', () => ({
7+
build: jest.fn().mockImplementation(
8+
async (
9+
filename: string,
10+
version: string,
11+
os_version: string
12+
): Promise<string> => {
13+
let extension_csv: string = process.env['extension-csv'] || '';
14+
let ini_values_csv: string = process.env['ini-values-csv'] || '';
15+
let coverage_driver: string = process.env['coverage'] || '';
16+
17+
let script: string = 'initial script';
18+
if (extension_csv) {
19+
script += 'install extensions';
20+
}
21+
if (ini_values_csv) {
22+
script += 'edit php.ini';
23+
}
24+
if (coverage_driver) {
25+
script += 'set coverage driver';
26+
}
27+
28+
return script;
29+
}
30+
),
31+
run: jest.fn().mockImplementation(
32+
async (): Promise<string> => {
33+
let os_version: string = process.env['RUNNER_OS'] || '';
34+
let version: string = process.env['php-version'] || '';
35+
let script: string = '';
36+
switch (os_version) {
37+
case 'darwin':
38+
case 'linux':
39+
script = await install.build(os_version + '.sh', version, os_version);
40+
script += 'sh script.sh ' + version + ' ' + __dirname;
41+
break;
42+
case 'win32':
43+
script = await install.build(os_version + '.sh', version, os_version);
44+
script +=
45+
'pwsh script.ps1 -version ' + version + ' -dir ' + __dirname;
46+
break;
47+
default:
48+
script += os_version + ' is not supported';
49+
}
50+
51+
return script;
52+
}
53+
)
54+
}));
55+
56+
/**
57+
* Function to set the process.env
58+
*
59+
* @param version
60+
* @param os
61+
* @param extension_csv
62+
* @param ini_values_csv
63+
* @param coverage_driver
64+
*/
65+
function setEnv(
66+
version: string,
67+
os: string,
68+
extension_csv: string,
69+
ini_values_csv: string,
70+
coverage_driver: string
71+
): void {
72+
process.env['php-version'] = version;
73+
process.env['RUNNER_OS'] = os;
74+
process.env['extension-csv'] = extension_csv;
75+
process.env['ini-values-csv'] = ini_values_csv;
76+
process.env['coverage'] = coverage_driver;
77+
}
78+
79+
describe('Install', () => {
80+
it('Test install on windows', async () => {
81+
setEnv('7.3', 'win32', '', '', '');
82+
// @ts-ignore
83+
let script: string = await install.run();
84+
expect(script).toContain('initial script');
85+
expect(script).toContain('pwsh script.ps1 -version 7.3 -dir ' + __dirname);
86+
87+
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x');
88+
// @ts-ignore
89+
script = await install.run();
90+
expect(script).toContain('initial script');
91+
expect(script).toContain('install extensions');
92+
expect(script).toContain('edit php.ini');
93+
expect(script).toContain('set coverage driver');
94+
expect(script).toContain('pwsh script.ps1 -version 7.3 -dir ' + __dirname);
95+
});
96+
97+
it('Test install on linux', async () => {
98+
setEnv('7.3', 'linux', '', '', '');
99+
// @ts-ignore
100+
let script: string = await install.run();
101+
expect(script).toContain('initial script');
102+
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
103+
104+
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x');
105+
// @ts-ignore
106+
script = await install.run();
107+
expect(script).toContain('initial script');
108+
expect(script).toContain('install extensions');
109+
expect(script).toContain('edit php.ini');
110+
expect(script).toContain('set coverage driver');
111+
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
112+
});
113+
114+
it('Test install on darwin', async () => {
115+
setEnv('7.3', 'darwin', '', '', '');
116+
// @ts-ignore
117+
let script: string = await install.run();
118+
expect(script).toContain('initial script');
119+
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
120+
121+
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x');
122+
// @ts-ignore
123+
script = await install.run();
124+
expect(script).toContain('initial script');
125+
expect(script).toContain('install extensions');
126+
expect(script).toContain('edit php.ini');
127+
expect(script).toContain('set coverage driver');
128+
expect(script).toContain('sh script.sh 7.3 ' + __dirname);
129+
});
130+
});

examples/phalcon-mysql.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ jobs:
3030
fail-fast: false
3131
max-parallel: 3
3232
matrix:
33-
php-versions: ['7.2', '7.3']
33+
php-versions: ['7.2', '7.3', '7.4']
3434
steps:
3535
- name: Checkout
3636
uses: actions/checkout@v1
3737
- name: Setup PHP, with composer and extensions
3838
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
3939
with:
4040
php-version: ${{ matrix.php-versions }}
41-
extension-csv: mbstring, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
41+
extension-csv: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
4242
coverage: xdebug #optional
4343
- name: Install Composer dependencies
4444
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader

examples/phalcon-postgres.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ jobs:
3131
fail-fast: false
3232
max-parallel: 3
3333
matrix:
34-
php-versions: ['7.2', '7.3']
34+
php-versions: ['7.2', '7.3', '7.4']
3535
steps:
3636
- name: Checkout
3737
uses: actions/checkout@v1
3838
- name: Setup PHP, with composer and extensions
3939
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
4040
with:
4141
php-version: ${{ matrix.php-versions }}
42-
extension-csv: mbstring, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
42+
extension-csv: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
4343
coverage: xdebug #optional
4444
- name: Install Composer dependencies
4545
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader

lib/extensions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function addExtensionWindows(extension_csv, version) {
118118
let install_command = '';
119119
switch (version + extension) {
120120
case '7.4xdebug':
121-
const extension_url = 'https://xdebug.org/files/php_xdebug-2.8.0beta2-7.4-vc15.dll';
121+
const extension_url = 'https://xdebug.org/files/php_xdebug-2.8.0-7.4-vc15.dll';
122122
install_command =
123123
'Invoke-WebRequest -Uri ' +
124124
extension_url +

lib/install.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function build(filename, version, os_version) {
4848
return yield utils.writeScript(filename, script);
4949
});
5050
}
51+
exports.build = build;
5152
/**
5253
* Run the script
5354
*/
@@ -57,23 +58,24 @@ function run() {
5758
let os_version = process.platform;
5859
let version = yield utils.getInput('php-version', true);
5960
// check the os version and run the respective script
60-
if (os_version == 'darwin') {
61-
let script_path = yield build('darwin.sh', version, os_version);
62-
yield exec_1.exec('sh ' + script_path + ' ' + version + ' ' + __dirname);
63-
}
64-
else if (os_version == 'win32') {
65-
let script_path = yield build('win32.ps1', version, os_version);
66-
yield exec_1.exec('pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname);
67-
}
68-
else if (os_version == 'linux') {
69-
let script_path = yield build('linux.sh', version, os_version);
70-
yield exec_1.exec('sh ' + script_path + ' ' + version + ' ' + __dirname);
61+
let script_path = '';
62+
switch (os_version) {
63+
case 'darwin':
64+
case 'linux':
65+
script_path = yield build(os_version + '.sh', version, os_version);
66+
yield exec_1.exec('sh ' + script_path + ' ' + version + ' ' + __dirname);
67+
break;
68+
case 'win32':
69+
script_path = yield build('win32.ps1', version, os_version);
70+
yield exec_1.exec('pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname);
71+
break;
7172
}
7273
}
7374
catch (error) {
7475
core.setFailed(error.message);
7576
}
7677
});
7778
}
79+
exports.run = run;
7880
// call the run function
7981
run();

node_modules/.bin/semver

-15
This file was deleted.

node_modules/.bin/semver.cmd

-7
This file was deleted.

0 commit comments

Comments
 (0)