mirror of
https://github.com/dcarbone/install-jq-action.git
synced 2026-02-12 11:06:55 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca8101273e | ||
|
|
de7c0d1fb1 | ||
|
|
8867ddb478 | ||
|
|
945d84920f | ||
|
|
1090b8bd11 | ||
|
|
ff922c75b7 | ||
|
|
7f4d6f4833 | ||
|
|
bfb9fa8e7d |
2
.github/workflows/example-linux.yaml
vendored
2
.github/workflows/example-linux.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Setup jq'
|
- name: 'Setup jq'
|
||||||
uses: dcarbone/install-jq-action@v2.0.0
|
uses: dcarbone/install-jq-action@v2
|
||||||
with:
|
with:
|
||||||
version: '${{ inputs.version }}'
|
version: '${{ inputs.version }}'
|
||||||
force: '${{ inputs.force }}'
|
force: '${{ inputs.force }}'
|
||||||
|
|||||||
2
.github/workflows/example-macos.yaml
vendored
2
.github/workflows/example-macos.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Setup jq'
|
- name: 'Setup jq'
|
||||||
uses: dcarbone/install-jq-action@v2.0.0
|
uses: dcarbone/install-jq-action@v2
|
||||||
with:
|
with:
|
||||||
version: '${{ inputs.version }}'
|
version: '${{ inputs.version }}'
|
||||||
force: '${{ inputs.force }}'
|
force: '${{ inputs.force }}'
|
||||||
|
|||||||
2
.github/workflows/example-windows.yaml
vendored
2
.github/workflows/example-windows.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Setup jq'
|
- name: 'Setup jq'
|
||||||
uses: dcarbone/install-jq-action@v2.0.0
|
uses: dcarbone/install-jq-action@v2
|
||||||
with:
|
with:
|
||||||
version: '${{ inputs.version }}'
|
version: '${{ inputs.version }}'
|
||||||
force: '${{ inputs.force }}'
|
force: '${{ inputs.force }}'
|
||||||
|
|||||||
187
.github/workflows/tests.yaml
vendored
187
.github/workflows/tests.yaml
vendored
@@ -23,20 +23,114 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
image:
|
image:
|
||||||
- "ubuntu-22.04"
|
- "ubuntu-latest"
|
||||||
- "ubuntu-20.04"
|
- "ubuntu-20.04"
|
||||||
|
- "ubuntu-22.04"
|
||||||
|
- "ubuntu-24.04"
|
||||||
|
- "macos-latest"
|
||||||
- "macos-13"
|
- "macos-13"
|
||||||
- "macos-11"
|
- "macos-14"
|
||||||
- "macos-12"
|
- "macos-15"
|
||||||
- "windows-2022"
|
- "windows-latest"
|
||||||
- "windows-2019"
|
- "windows-2019"
|
||||||
|
- "windows-2022"
|
||||||
force:
|
force:
|
||||||
- 'true'
|
- 'true'
|
||||||
- 'false'
|
- 'false'
|
||||||
version:
|
version:
|
||||||
- '1.5'
|
|
||||||
- '1.6'
|
|
||||||
- '1.7'
|
- '1.7'
|
||||||
|
include:
|
||||||
|
- image: "ubuntu-latest"
|
||||||
|
version: '1.6'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-latest"
|
||||||
|
version: '1.6'
|
||||||
|
force: false
|
||||||
|
- image: "ubuntu-latest"
|
||||||
|
version: '1.5'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-latest"
|
||||||
|
version: '1.5'
|
||||||
|
force: false
|
||||||
|
|
||||||
|
- image: "ubuntu-20.04"
|
||||||
|
version: '1.6'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-20.04"
|
||||||
|
version: '1.6'
|
||||||
|
force: false
|
||||||
|
- image: "ubuntu-20.04"
|
||||||
|
version: '1.5'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-20.04"
|
||||||
|
version: '1.5'
|
||||||
|
force: false
|
||||||
|
|
||||||
|
- image: "ubuntu-22.04"
|
||||||
|
version: '1.6'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-22.04"
|
||||||
|
version: '1.6'
|
||||||
|
force: false
|
||||||
|
- image: "ubuntu-22.04"
|
||||||
|
version: '1.5'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-22.04"
|
||||||
|
version: '1.5'
|
||||||
|
force: false
|
||||||
|
|
||||||
|
- image: "ubuntu-24.04"
|
||||||
|
version: '1.6'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-24.04"
|
||||||
|
version: '1.6'
|
||||||
|
force: false
|
||||||
|
- image: "ubuntu-24.04"
|
||||||
|
version: '1.5'
|
||||||
|
force: true
|
||||||
|
- image: "ubuntu-24.04"
|
||||||
|
version: '1.5'
|
||||||
|
force: false
|
||||||
|
|
||||||
|
- image: "windows-latest"
|
||||||
|
version: '1.6'
|
||||||
|
force: true
|
||||||
|
- image: "windows-latest"
|
||||||
|
version: '1.6'
|
||||||
|
force: false
|
||||||
|
- image: "windows-latest"
|
||||||
|
version: '1.5'
|
||||||
|
force: true
|
||||||
|
- image: "windows-latest"
|
||||||
|
version: '1.5'
|
||||||
|
force: false
|
||||||
|
|
||||||
|
- image: "windows-2019"
|
||||||
|
version: '1.6'
|
||||||
|
force: true
|
||||||
|
- image: "windows-2019"
|
||||||
|
version: '1.6'
|
||||||
|
force: false
|
||||||
|
- image: "windows-2019"
|
||||||
|
version: '1.5'
|
||||||
|
force: true
|
||||||
|
- image: "windows-2019"
|
||||||
|
version: '1.5'
|
||||||
|
force: false
|
||||||
|
|
||||||
|
- image: "windows-2022"
|
||||||
|
version: '1.6'
|
||||||
|
force: true
|
||||||
|
- image: "windows-2022"
|
||||||
|
version: '1.6'
|
||||||
|
force: false
|
||||||
|
- image: "windows-2022"
|
||||||
|
version: '1.5'
|
||||||
|
force: true
|
||||||
|
- image: "windows-2022"
|
||||||
|
version: '1.5'
|
||||||
|
force: false
|
||||||
|
|
||||||
name: "Test Action - (img: ${{ matrix.image }}; version: ${{ matrix.version }}; force: ${{ matrix.force }})"
|
name: "Test Action - (img: ${{ matrix.image }}; version: ${{ matrix.version }}; force: ${{ matrix.force }})"
|
||||||
runs-on: ${{ matrix.image }}
|
runs-on: ${{ matrix.image }}
|
||||||
steps:
|
steps:
|
||||||
@@ -169,3 +263,84 @@ jobs:
|
|||||||
{
|
{
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
test-container:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
image:
|
||||||
|
- "ubuntu-24.04"
|
||||||
|
- "ubuntu-22.04"
|
||||||
|
- "ubuntu-20.04"
|
||||||
|
force:
|
||||||
|
- 'true'
|
||||||
|
- 'false'
|
||||||
|
version:
|
||||||
|
- '1.5'
|
||||||
|
- '1.6'
|
||||||
|
- '1.7'
|
||||||
|
name: "Test Action (Container) - (img: ${{ matrix.image }}; version: ${{ matrix.version }}; force: ${{ matrix.force }})"
|
||||||
|
runs-on: ${{ matrix.image }}
|
||||||
|
container:
|
||||||
|
image: node:20
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup jq
|
||||||
|
id: install-jq
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: '${{ matrix.version }}'
|
||||||
|
force: '${{ matrix.force }}'
|
||||||
|
|
||||||
|
- name: Check jq
|
||||||
|
# language=sh
|
||||||
|
run: |
|
||||||
|
_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
|
||||||
|
# language=sh
|
||||||
|
run: |
|
||||||
|
_installed='${{ steps.install-jq.outputs.installed }}'
|
||||||
|
_err=
|
||||||
|
if [[ '${{ matrix.force }}' == 'true' ]]; then
|
||||||
|
# enabling "force" must result in an install
|
||||||
|
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
||||||
|
echo 'Unexpected value for "installed":'
|
||||||
|
echo 'Expected: "true"'
|
||||||
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
|
_err=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ '${{ steps.install-jq.outputs.found }}' == 'true' ]]; then
|
||||||
|
# if found, must not be installed without force
|
||||||
|
if [[ '${{ steps.install-jq.outputs.installed }}' != 'false' ]]; then
|
||||||
|
echo 'Unexpected value for "installed":'
|
||||||
|
echo 'Expected: "false"'
|
||||||
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
|
_err=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# if not found, must be installed
|
||||||
|
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
||||||
|
echo 'Unexpected value for "installed":'
|
||||||
|
echo 'Expected: "true"'
|
||||||
|
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||||
|
_err=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -n "${_err}" ]; then exit 1; fi;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
JQ_VERSION: '${{ inputs.version }}'
|
JQ_VERSION: '${{ inputs.version }}'
|
||||||
# language=sh
|
# language=sh
|
||||||
run: ${{ github.action_path }}/scripts/unixish.sh
|
run: ${GITHUB_ACTION_PATH}/scripts/unixish.sh
|
||||||
|
|
||||||
- name: 'Install jq - Unix-ish 1.7'
|
- name: 'Install jq - Unix-ish 1.7'
|
||||||
if: (runner.os == 'Linux' || runner.os == 'macOS') && inputs.version == '1.7' && (steps.jq-check-unix.outputs.found == 'false' || inputs.force == 'true')
|
if: (runner.os == 'Linux' || runner.os == 'macOS') && inputs.version == '1.7' && (steps.jq-check-unix.outputs.found == 'false' || inputs.force == 'true')
|
||||||
@@ -54,7 +54,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
JQ_VERSION: '${{ inputs.version }}'
|
JQ_VERSION: '${{ inputs.version }}'
|
||||||
# language=sh
|
# language=sh
|
||||||
run: ${{ github.action_path }}/scripts/unixish-17.sh
|
run: ${GITHUB_ACTION_PATH}/scripts/unixish-17.sh
|
||||||
|
|
||||||
- name: 'Check for jq - Windows-ish'
|
- name: 'Check for jq - Windows-ish'
|
||||||
id: jq-check-windows
|
id: jq-check-windows
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ echo '::group::Downloading jq'
|
|||||||
echo "Src: ${_dl_url}"
|
echo "Src: ${_dl_url}"
|
||||||
echo "Dst: ${_dl_path}"
|
echo "Dst: ${_dl_path}"
|
||||||
|
|
||||||
wget -O- "${_dl_url}" > "${_dl_path}"
|
curl -L "${_dl_url}" -o "${_dl_path}"
|
||||||
|
|
||||||
echo '::endgroup::'
|
echo '::endgroup::'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ esac
|
|||||||
|
|
||||||
# determine binary name
|
# determine binary name
|
||||||
|
|
||||||
if [[ "${_os}" == "linux" ]]; then
|
if [ "${_os}" = "linux" ]; then
|
||||||
case "${_arch}" in
|
case "${_arch}" in
|
||||||
'386')
|
'386')
|
||||||
_bin_name="jq-linux32"
|
_bin_name="jq-linux32"
|
||||||
@@ -93,7 +93,7 @@ echo '::group::Downloading jq'
|
|||||||
echo "Src: ${_dl_url}"
|
echo "Src: ${_dl_url}"
|
||||||
echo "Dst: ${_dl_path}"
|
echo "Dst: ${_dl_path}"
|
||||||
|
|
||||||
wget -O- "${_dl_url}" > "${_dl_path}"
|
curl -L "${_dl_url}" -o "${_dl_path}"
|
||||||
|
|
||||||
echo '::endgroup::'
|
echo '::endgroup::'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user