Skip to content

Commit

Permalink
fix filter value for nf-test dry-run (#7340)
Browse files Browse the repository at this point in the history
* fix filter value for nf-test dry-run

* fix if condition
  • Loading branch information
mashehu authored Jan 21, 2025
1 parent 26a34ec commit c0e2936
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
15 changes: 12 additions & 3 deletions .github/actions/get-shards/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,25 @@ runs:
id: shards
shell: bash
run: |
# Run nf-test to get the number of related tests
nftest_output=$(nf-test test --dry-run --changed-since HEAD^ --filter pipeline --tag ${{ inputs.tags }} ${{ inputs.paths}})
# Prepare tag parameter if tags are provided
TAGS=$([ -n "${{ inputs.tags }}" ] && echo "--tag ${{ inputs.tags }}" || echo "")
# Run nf-test with dynamic tag parameter
nftest_output=$(nf-test test \
--dry-run \
--profile docker \
${TAGS} \
--filter process,workflow \
${{ inputs.paths }})
echo "nf-test dry-run output: $nftest_output"
# Default values for shard and total_shards
shard="[]"
total_shards=0
# Check if there are related tests
if echo "$nftest_output" | grep -q 'Nothing to do'; then
if echo "$nftest_output" | grep -q 'No tests to execute'; then
echo "No related tests found."
else
# Extract the number of related tests
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/nf-test-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ runs:
SENTIEON_AUTH_MECH: "GitHub Actions - token"
run: |
NFT_WORKDIR=~ \
NFT_DIFF=pdiff \
NFT_DIFF_ARGS="--line-numbers --expand-tabs=2"
nf-test test \
--profile=${{ inputs.profile }} \
--tap=test.tap \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nf-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: get number of shards
id: set-shards
if: ${{ steps.list.outputs.components != '' }}
if: ${{ steps.list.outputs.components != '[]' }}
uses: ./.github/actions/get-shards
env:
NFT_VER: ${{ env.NFT_VER }}
Expand Down

0 comments on commit c0e2936

Please sign in to comment.