mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Fix reading unquoted versions
This commit is contained in:
parent
8f8207a1ca
commit
2b027bd9bc
2
.github/workflows/experimental-workflow.yml
vendored
2
.github/workflows/experimental-workflow.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, ubuntu-16.04, macOS-latest]
|
||||
php-versions: ['8.0']
|
||||
php-versions: [8.0]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
|
||||
php-versions: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
@ -31,7 +31,8 @@ jest.mock('../src/install', () => ({
|
||||
run: jest.fn().mockImplementation(
|
||||
async (): Promise<string> => {
|
||||
const os_version: string = process.env['RUNNER_OS'] || '';
|
||||
const version: string = process.env['php-version'] || '';
|
||||
let version: string = process.env['php-version'] || '';
|
||||
version = version.length > 1 ? version : version + '.0';
|
||||
let script = '';
|
||||
switch (os_version) {
|
||||
case 'darwin':
|
||||
@ -85,10 +86,16 @@ function setEnv(
|
||||
|
||||
describe('Install', () => {
|
||||
it('Test install on windows', async () => {
|
||||
setEnv('7.3', 'win32', '', '', '', '');
|
||||
setEnv('7.0', 'win32', '', '', '', '');
|
||||
// @ts-ignore
|
||||
let script: string = await install.run();
|
||||
expect(script).toContain('initial script');
|
||||
expect(script).toContain('pwsh script.ps1 -version 7.0 -dir ' + __dirname);
|
||||
|
||||
setEnv('7.3', 'win32', '', '', '', '');
|
||||
// @ts-ignore
|
||||
script = await install.run();
|
||||
expect(script).toContain('initial script');
|
||||
expect(script).toContain('pwsh script.ps1 -version 7.3 -dir ' + __dirname);
|
||||
|
||||
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '');
|
||||
|
3
dist/index.js
vendored
3
dist/index.js
vendored
@ -1831,7 +1831,8 @@ function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const os_version = process.platform;
|
||||
const version = yield utils.getInput('php-version', true);
|
||||
let version = yield utils.getInput('php-version', true);
|
||||
version = version.length > 1 ? version : version + '.0';
|
||||
// check the os version and run the respective script
|
||||
let script_path = '';
|
||||
switch (os_version) {
|
||||
|
@ -46,7 +46,8 @@ export async function build(
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const os_version: string = process.platform;
|
||||
const version: string = await utils.getInput('php-version', true);
|
||||
let version: string = await utils.getInput('php-version', true);
|
||||
version = version.length > 1 ? version : version + '.0';
|
||||
// check the os version and run the respective script
|
||||
let script_path = '';
|
||||
switch (os_version) {
|
||||
|
Loading…
Reference in New Issue
Block a user