From 22c3fc1e132d1a10151473943e977b47bd846917 Mon Sep 17 00:00:00 2001 From: Daniel Carbone Date: Wed, 2 Nov 2022 17:36:03 -0500 Subject: [PATCH] Adding version check to tests --- .github/workflows/tests.yaml | 39 ++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index dbf445e..60b6d8a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -33,7 +33,10 @@ jobs: force: - 'true' - 'false' - name: "Test Action - (img: ${{ matrix.image }}; force: ${{ matrix.force }})" + version: + - '1.5' + - '1.6' + name: "Test Action - (img: ${{ matrix.image }}; version: ${{ matrix.version }}; force: ${{ matrix.force }})" runs-on: ${{ matrix.image }} steps: - uses: actions/checkout@v3.1.0 @@ -42,13 +45,29 @@ jobs: id: install-jq uses: dcarbone/install-jq-action@main with: + version: '${{ matrix.version }}' force: '${{ matrix.force }}' - name: Check jq - Unix-ish - if: runner.os == 'Linux' || runner.os == 'macOS' + if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.force == 'true' + shell: bash +e {0} run: | - which jq - jq --version + _err= + _which="$(which jq)" + _vers="$(jq --version)" + if [[ "${_which}" != "$RUNNER_TOOL_CACHE/jq/jq" ]]; then + echo "jq found at unexpected path." + echo " Expected: \"$RUNNER_TOOL_CACHE/jq/jq\"" + echo " Actual: \"${_which}\"" + _err=1 + fi + if [[ "${_vers}" != 'jq-${{ matrix.version }}' ]]; then + echo "jq --version returned unexpected value" + echo ' Expected: "jq-${{ matrix.version }}"' + echo " Actual: \"${_vers}\"" + _err=1 + fi + if [ -n "${_err}" ]; then exit 1; fi; - name: Check Outputs - Unix-ish if: runner.os == 'Linux' || runner.os == 'macOS' @@ -87,10 +106,18 @@ jobs: - name: Check jq - Windows-ish - if: runner.os == 'Windows' + if: runner.os == 'Windows' && matrix.force == 'true' run: | Get-Command "jq.exe" - jq.exe --version + $_cmd={jq.exe --version } + $_vers=jq.exe --version 2>&1 + if ( "${_vers}" -ne "jq-${{ matrix.version }}" ) + { + Write-Host "jq.exe --version returned unexpected value" + Write-Host " Expected: jq-${{ matrix.version }}" + Write-Host " Actual: ${_vers}" + exit 1 + } - name: Check Outputs - Windows-ish if: runner.os == 'Windows'