bumping install-yq-version to 1.3.1 for empty version fix (#6) #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Tests - YAML to Env action' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'action.yaml' | |
- '.github/workflows/tests.yaml' | |
- 'test-values.yaml' | |
pull_request: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
yq-version: | |
- '' | |
- 'v4.44.3' | |
name: 'Test Action (yq: ${{ matrix.yq-version }})' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Execute action | |
id: y2e | |
uses: ./ | |
with: | |
yaml-file: test-values.yaml | |
mask-values: "true" | |
yq-version: '${{ matrix.yq-version }}' | |
- name: Test env | |
# language=sh | |
run: | | |
_EXPECTED_ENVS=( | |
"STRING" | |
"hello there" | |
'${{ env.STRING }}' | |
"STRING_QUOTED" | |
"hello there" | |
'${{ env.STRING_QUOTED }}' | |
"STRING_INNER_QUOTED" | |
'hello "there"' | |
'${{ env.STRING_INNER_QUOTED }}' | |
"STRING_MULTILINE" | |
'This is some multiline text | |
this is pretty cool | |
the quork brewn facs jammed über teh cndl | |
' | |
'${{ env.STRING_MULTILINE }}' | |
"STRING_MULTILINE_BAR" | |
'This is some multiline text | |
this is pretty cool | |
the quork brewn facs jammed über teh cndl' | |
'${{ env.STRING_MULTILINE_BAR }}' | |
"NUMBER" | |
"5" | |
'${{ env.NUMBER }}' | |
"FLOAT" | |
"5.5" | |
'${{ env.FLOAT }}' | |
"OBJECT_KEY1" | |
"value1" | |
'${{ env.OBJECT_KEY1 }}' | |
"OBJECT_KEY2" | |
"2" | |
'${{ env.OBJECT_KEY2 }}' | |
"OBJECT_KEY3_0" | |
"nested value 1" | |
'${{ env.OBJECT_KEY3_0 }}' | |
"OBJECT_KEY3_1" | |
"nested value 2" | |
'${{ env.OBJECT_KEY3_1 }}' | |
"OBJECT_KEY3_2" | |
'nested value "3"' | |
'${{ env.OBJECT_KEY3_2 }}' | |
"ARRAY_0" | |
"one" | |
'${{ env.ARRAY_0 }}' | |
"ARRAY_1" | |
"two" | |
'${{ env.ARRAY_1 }}' | |
"ARRAY_2_0" | |
"nested one" | |
'${{ env.ARRAY_2_0 }}' | |
"STRING_WITH_EQUALS" | |
'value = yep' | |
'${{ env.STRING_WITH_EQUALS }}' | |
"STRING_MULTILINE_WITH_EQUALS" | |
'value | |
= | |
yep | |
' | |
'${{ env.STRING_MULTILINE_WITH_EQUALS }}' | |
'HYPHENATED_KEY' | |
"hi there." | |
'${{ env.HYPHENATED_KEY }}' | |
'SECOND_HYPHENATED_KEY' | |
'hi there.' | |
'${{ env.SECOND_HYPHENATED_KEY }}' | |
'KEY_WITH__WEIRD___' | |
'what have you got.' | |
'${{ env.KEY_WITH__WEIRD___ }}' | |
) | |
for (( i=0; i < "${#_EXPECTED_ENVS[@]}"; i+=3 )); do | |
_env="${_EXPECTED_ENVS[$i]}" | |
_exp="${_EXPECTED_ENVS[$i+1]}" | |
_act="${_EXPECTED_ENVS[$i+2]}" | |
if [[ "${_act}" != "${_exp}" ]]; then | |
echo "Environment variable \"${_env}\" value mismatch:" | |
echo " Expected: \"${_exp}\"" | |
echo " Actual: \"${_act}\"" | |
exit 1 | |
fi | |
done |