mirror of
https://github.com/dcarbone/install-jq-action.git
synced 2026-02-12 02:56:56 +08:00
1.7.1 for windows and some small cleanup (#17)
* 171 for windows and some small cleanup * startWith -> startsWith
This commit is contained in:
38
.github/workflows/tests.yaml
vendored
38
.github/workflows/tests.yaml
vendored
@@ -155,15 +155,13 @@ jobs:
|
|||||||
if: runner.os == 'Linux' || runner.os == 'macOS'
|
if: runner.os == 'Linux' || runner.os == 'macOS'
|
||||||
# language=sh
|
# language=sh
|
||||||
run: |
|
run: |
|
||||||
_installed='${{ steps.install-jq.outputs.installed }}'
|
|
||||||
_err=
|
|
||||||
if [[ '${{ matrix.force }}' == 'true' ]]; then
|
if [[ '${{ matrix.force }}' == 'true' ]]; then
|
||||||
# enabling "force" must result in an install
|
# enabling "force" must result in an install
|
||||||
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
||||||
echo 'Unexpected value for "installed":'
|
echo 'Unexpected value for "installed":'
|
||||||
echo 'Expected: "true"'
|
echo 'Expected: "true"'
|
||||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ '${{ steps.install-jq.outputs.found }}' == 'true' ]]; then
|
if [[ '${{ steps.install-jq.outputs.found }}' == 'true' ]]; then
|
||||||
@@ -172,7 +170,7 @@ jobs:
|
|||||||
echo 'Unexpected value for "installed":'
|
echo 'Unexpected value for "installed":'
|
||||||
echo 'Expected: "false"'
|
echo 'Expected: "false"'
|
||||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# if not found, must be installed
|
# if not found, must be installed
|
||||||
@@ -180,12 +178,10 @@ jobs:
|
|||||||
echo 'Unexpected value for "installed":'
|
echo 'Unexpected value for "installed":'
|
||||||
echo 'Expected: "true"'
|
echo 'Expected: "true"'
|
||||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "${_err}" ]; then exit 1; fi;
|
|
||||||
|
|
||||||
|
|
||||||
- name: Check jq - Windows-ish
|
- name: Check jq - Windows-ish
|
||||||
if: runner.os == 'Windows' && matrix.force == 'true'
|
if: runner.os == 'Windows' && matrix.force == 'true'
|
||||||
@@ -210,7 +206,6 @@ jobs:
|
|||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
$_installed='${{ steps.install-jq.outputs.installed }}'
|
$_installed='${{ steps.install-jq.outputs.installed }}'
|
||||||
$_err = 0
|
|
||||||
if ("${{ matrix.force }}" -eq "true")
|
if ("${{ matrix.force }}" -eq "true")
|
||||||
{
|
{
|
||||||
# enabling "force" must result in an install
|
# enabling "force" must result in an install
|
||||||
@@ -219,7 +214,7 @@ jobs:
|
|||||||
Write-Host "Unexpected value for installed"
|
Write-Host "Unexpected value for installed"
|
||||||
Write-Host "Expected: true"
|
Write-Host "Expected: true"
|
||||||
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
||||||
$_err=1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -232,7 +227,7 @@ jobs:
|
|||||||
Write-Host "Unexpected value for installed"
|
Write-Host "Unexpected value for installed"
|
||||||
Write-Host "Expected: false"
|
Write-Host "Expected: false"
|
||||||
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
||||||
$_err=1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -242,14 +237,10 @@ jobs:
|
|||||||
Write-Host "Unexpected value for installed"
|
Write-Host "Unexpected value for installed"
|
||||||
Write-Host "Expected: true"
|
Write-Host "Expected: true"
|
||||||
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
||||||
$_err=1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ("${_err}" -ne 0)
|
|
||||||
{
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
test-container:
|
test-container:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -281,35 +272,31 @@ jobs:
|
|||||||
- name: Check jq
|
- name: Check jq
|
||||||
# language=sh
|
# language=sh
|
||||||
run: |
|
run: |
|
||||||
_err=
|
|
||||||
_which="$(which jq)"
|
_which="$(which jq)"
|
||||||
_vers="$(jq --version)"
|
_vers="$(jq --version)"
|
||||||
if [[ "${_which}" != "$RUNNER_TOOL_CACHE/jq/jq" ]]; then
|
if [[ "${_which}" != "$RUNNER_TOOL_CACHE/jq/jq" ]]; then
|
||||||
echo "jq found at unexpected path."
|
echo "jq found at unexpected path."
|
||||||
echo " Expected: \"$RUNNER_TOOL_CACHE/jq/jq\""
|
echo " Expected: \"$RUNNER_TOOL_CACHE/jq/jq\""
|
||||||
echo " Actual: \"${_which}\""
|
echo " Actual: \"${_which}\""
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "${_vers}" != 'jq-${{ matrix.version }}' ]]; then
|
if [[ "${_vers}" != 'jq-${{ matrix.version }}' ]]; then
|
||||||
echo "jq --version returned unexpected value"
|
echo "jq --version returned unexpected value"
|
||||||
echo ' Expected: "jq-${{ matrix.version }}"'
|
echo ' Expected: "jq-${{ matrix.version }}"'
|
||||||
echo " Actual: \"${_vers}\""
|
echo " Actual: \"${_vers}\""
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -n "${_err}" ]; then exit 1; fi;
|
|
||||||
|
|
||||||
- name: Check Outputs
|
- name: Check Outputs
|
||||||
# language=sh
|
# language=sh
|
||||||
run: |
|
run: |
|
||||||
_installed='${{ steps.install-jq.outputs.installed }}'
|
|
||||||
_err=
|
|
||||||
if [[ '${{ matrix.force }}' == 'true' ]]; then
|
if [[ '${{ matrix.force }}' == 'true' ]]; then
|
||||||
# enabling "force" must result in an install
|
# enabling "force" must result in an install
|
||||||
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
||||||
echo 'Unexpected value for "installed":'
|
echo 'Unexpected value for "installed":'
|
||||||
echo 'Expected: "true"'
|
echo 'Expected: "true"'
|
||||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ '${{ steps.install-jq.outputs.found }}' == 'true' ]]; then
|
if [[ '${{ steps.install-jq.outputs.found }}' == 'true' ]]; then
|
||||||
@@ -318,7 +305,7 @@ jobs:
|
|||||||
echo 'Unexpected value for "installed":'
|
echo 'Unexpected value for "installed":'
|
||||||
echo 'Expected: "false"'
|
echo 'Expected: "false"'
|
||||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# if not found, must be installed
|
# if not found, must be installed
|
||||||
@@ -326,8 +313,7 @@ jobs:
|
|||||||
echo 'Unexpected value for "installed":'
|
echo 'Unexpected value for "installed":'
|
||||||
echo 'Expected: "true"'
|
echo 'Expected: "true"'
|
||||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
_err=1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "${_err}" ]; then exit 1; fi;
|
|
||||||
|
|||||||
@@ -72,14 +72,14 @@ runs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
- name: 'Install jq - Windows-ish non-1.7'
|
- name: 'Install jq - Windows-ish non-1.7'
|
||||||
if: runner.os == 'Windows' && (inputs.version == '1.5' || inputs.version == '1.6') && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
|
if: runner.os == 'Windows' && (startsWith(inputs.version, '1.5') || startsWith(inputs.version, '1.6')) && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
|
||||||
shell: powershell
|
shell: powershell
|
||||||
env:
|
env:
|
||||||
JQ_VERSION: '${{ inputs.version }}'
|
JQ_VERSION: '${{ inputs.version }}'
|
||||||
run: ${{ github.action_path }}\scripts\windowsish.ps1
|
run: ${{ github.action_path }}\scripts\windowsish.ps1
|
||||||
|
|
||||||
- name: 'Install jq - Windows-ish 1.7'
|
- name: 'Install jq - Windows-ish 1.7'
|
||||||
if: runner.os == 'Windows' && inputs.version == '1.7' && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
|
if: runner.os == 'Windows' && startsWith(inputs.version, '1.7') && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
|
||||||
shell: powershell
|
shell: powershell
|
||||||
env:
|
env:
|
||||||
JQ_VERSION: '${{ inputs.version }}'
|
JQ_VERSION: '${{ inputs.version }}'
|
||||||
|
|||||||
Reference in New Issue
Block a user