6 Commits

Author SHA1 Message Date
Daniel Carbone
8867ddb478 remove windows gubbins from container tests 2023-11-07 14:50:52 -06:00
Michael Busby
945d84920f Support running action inside containers (#10)
* Add container tests

* Update github actions path to fix container compat
2023-11-07 14:47:46 -06:00
akhil
1090b8bd11 use curl instead of wget to fix failure on macOS runners (#8) 2023-09-29 12:04:15 -05:00
Daniel Carbone
ff922c75b7 Update example-windows.yaml 2023-09-27 19:11:45 -05:00
Daniel Carbone
7f4d6f4833 Update example-macos.yaml 2023-09-27 19:11:32 -05:00
Daniel Carbone
bfb9fa8e7d Update example-linux.yaml 2023-09-27 19:11:18 -05:00
7 changed files with 87 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2.0.0
uses: dcarbone/install-jq-action@v2
with:
version: '${{ inputs.version }}'
force: '${{ inputs.force }}'

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: macos-latest
steps:
- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2.0.0
uses: dcarbone/install-jq-action@v2
with:
version: '${{ inputs.version }}'
force: '${{ inputs.force }}'

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: windows-latest
steps:
- name: 'Setup jq'
uses: dcarbone/install-jq-action@v2.0.0
uses: dcarbone/install-jq-action@v2
with:
version: '${{ inputs.version }}'
force: '${{ inputs.force }}'

View File

@@ -169,3 +169,83 @@ jobs:
{
exit 1
}
test-container:
strategy:
matrix:
image:
- "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:18.12.1
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;

View File

@@ -46,7 +46,7 @@ runs:
env:
JQ_VERSION: '${{ inputs.version }}'
# language=sh
run: ${{ github.action_path }}/scripts/unixish.sh
run: ${GITHUB_ACTION_PATH}/scripts/unixish.sh
- 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')
@@ -54,7 +54,7 @@ runs:
env:
JQ_VERSION: '${{ inputs.version }}'
# language=sh
run: ${{ github.action_path }}/scripts/unixish-17.sh
run: ${GITHUB_ACTION_PATH}/scripts/unixish-17.sh
- name: 'Check for jq - Windows-ish'
id: jq-check-windows

View File

@@ -73,7 +73,7 @@ echo '::group::Downloading jq'
echo "Src: ${_dl_url}"
echo "Dst: ${_dl_path}"
wget -O- "${_dl_url}" > "${_dl_path}"
curl -L "${_dl_url}" -o "${_dl_path}"
echo '::endgroup::'

View File

@@ -93,7 +93,7 @@ echo '::group::Downloading jq'
echo "Src: ${_dl_url}"
echo "Dst: ${_dl_path}"
wget -O- "${_dl_url}" > "${_dl_path}"
curl -L "${_dl_url}" -o "${_dl_path}"
echo '::endgroup::'