Skip to content

Commit

Permalink
Fix incorrect behavior with quotes in arguments (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw authored Oct 18, 2023
1 parent 3788642 commit 510c5e9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ jobs:
pip install pytest pytest-md pytest-emoji
- uses: ./.

quotes:
name: Test quotes
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install pytest pytest-md pytest-emoji
- uses: ./.
with:
custom-arguments: -k "not failed"

test-micromamba:
name: Run tests (setup-micromamba)
strategy:
Expand Down
10 changes: 1 addition & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,9 @@ runs:
- name: Run pytest
id: pytest
run: |
echo "::group::..."
REPORT="$(mktemp)"
echo "report-path=$REPORT" >> $GITHUB_OUTPUT
args=()
if [ ${{ inputs.verbose }} = true ]; then args+=('-v'); fi
if [ ${{ inputs.job-summary }} = true ]; then args+=("--md=$REPORT"); fi
if [ ${{ inputs.emoji }} = true ]; then args+=('--emoji'); fi
# unpack custom arguments from spaces to array
args+=(`echo "${{ inputs.custom-arguments }}"`)
echo "::endgroup::"
${{ inputs.custom-pytest }} "${args[@]}"
${{ inputs.custom-pytest }}${{ inputs.verbose == 'true' && ' -v' || '' }}${{ inputs.job-summary == 'true' && ' --md=$REPORT' || '' }}${{ inputs.emoji == 'true' && ' --emoji' || '' }}${{ inputs.custom-arguments != '' && ' ' || '' }}${{ inputs.custom-arguments }}
shell: bash -el {0} # use login shell to source .bashrc for environments
- name: Add report to summary
# run even if pytest fails
Expand Down

0 comments on commit 510c5e9

Please sign in to comment.