-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into validate-environment.ymls
- Loading branch information
Showing
1,203 changed files
with
37,266 additions
and
12,796 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: "Get number of shards" | ||
description: "Get the number of nf-test shards for the current CI job" | ||
inputs: | ||
tags: | ||
description: "Tags to pass as argument for nf-test --tag parameter" | ||
required: true | ||
max_shards: | ||
description: "Maximum number of shards allowed" | ||
required: true | ||
paths: | ||
description: "Component paths to test" | ||
required: false | ||
outputs: | ||
shard: | ||
description: "Array of shard numbers" | ||
value: ${{ steps.shards.outputs.shard }} | ||
total_shards: | ||
description: "Total number of shards" | ||
value: ${{ steps.shards.outputs.total_shards }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install nf-test | ||
uses: nf-core/setup-nf-test@v1 | ||
with: | ||
version: ${{ env.NFT_VER }} | ||
install-pdiff: true | ||
|
||
- name: Get number of shards | ||
id: shards | ||
shell: bash | ||
run: | | ||
# 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 'No tests to execute'; then | ||
echo "No related tests found." | ||
else | ||
# Extract the number of related tests | ||
number_of_shards=$(echo "$nftest_output" | sed -n 's|.*Executed \([0-9]*\) tests.*|\1|p') | ||
if [[ -n "$number_of_shards" && "$number_of_shards" -gt 0 ]]; then | ||
shards_to_run=$(( $number_of_shards < ${{ inputs.max_shards }} ? $number_of_shards : ${{ inputs.max_shards }} )) | ||
shard=$(seq 1 "$shards_to_run" | jq -R . | jq -c -s .) | ||
total_shards="$shards_to_run" | ||
else | ||
echo "Unexpected output format. Falling back to default values." | ||
fi | ||
fi | ||
# Write to GitHub Actions outputs | ||
echo "shard=$shard" >> $GITHUB_OUTPUT | ||
echo "total_shards=$total_shards" >> $GITHUB_OUTPUT | ||
# Debugging output | ||
echo "Final shard array: $shard" | ||
echo "Total number of shards: $total_shards" |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.