Skip to content

Commit

Permalink
Build nextflow schemas and params with viash 0.9 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
DriesSchaumont authored Jul 24, 2024
1 parent c113a65 commit b46ff03
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# viash-actions v6.5.0

## New functionality

* `build-nextflow-params` and `build-nextflow-schemas`: allow using viash versions starting from `0.9.0` (PR #41).

# viash-actions v6.4.0

## New functionality
Expand Down
33 changes: 24 additions & 9 deletions pro/build-nextflow-params/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,31 @@ runs:
TARGET_DIR="${{ steps.defaults.outputs.target_dir }}"
BUILT_CONFIGS=$(find "$TARGET_DIR" -name .config.vsh.yaml)
readarray -d '' BUILT_CONFIGS < <(find "$TARGET_DIR" -name .config.vsh.yaml -print0)
echo "Detected configs:"
echo "$BUILT_CONFIGS"
printf "%s\n" "${BUILT_CONFIGS[@]}"
echo
NEXTFLOW_PARAMS=$(echo "$BUILT_CONFIGS" | sed 's/.config.vsh.yaml/nextflow_params.yaml/g')
NEXTFLOW_PARAMS=()
for config_path in "${BUILT_CONFIGS[@]}"; do
dir=$(dirname "$config_path")
NEXTFLOW_PARAMS+=("$dir/nextflow_params.yaml")
done
echo "Building Nextflow param files:"
echo "$NEXTFLOW_PARAMS"
printf "%s\n" "${NEXTFLOW_PARAMS[@]}"
echo
viash_tools/target/docker/nextflow/generate_params/generate_params \
--input $(echo "$BUILT_CONFIGS" | paste -sd ";") \
--output $(echo "$NEXTFLOW_PARAMS" | paste -sd ";")
VIASH_VERSION=`viash -v | grep -oP 'viash \K[0-9.]+'`
IFS=. read -r major minor patch <<< $VIASH_VERSION
JOINED_CONFIGS=$(IFS=';'; printf '%s' "${BUILT_CONFIGS[*]}")
JOINED_PARAMS=$(IFS=';'; printf '%s' "${NEXTFLOW_PARAMS[*]}")
if (( "$major" > 0 )) || (( "$minor" >= 9 )); then
VIASH_VERSION_LONG=$(viash -v | grep -oP 'viash \K[0-9.]+.\w+')
viash_tools/target/docker/nextflow/generate_params_v9/generate_params_v9 \
--input "$JOINED_CONFIGS" \
--output "$JOINED_PARAMS" \
--viash_version $VIASH_VERSION_LONG
else
viash_tools/target/docker/nextflow/generate_params/generate_params \
--input "$JOINED_CONFIGS" \
--output "$JOINED_PARAMS"
fi
30 changes: 24 additions & 6 deletions pro/build-nextflow-schemas/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,35 @@ runs:
TARGET_DIR="${{ steps.defaults.outputs.target_dir }}"
BUILT_CONFIGS=$(find "$TARGET_DIR" -name .config.vsh.yaml)
readarray -d '' BUILT_CONFIGS < <(find "$TARGET_DIR" -name .config.vsh.yaml -print0)
echo "Detected configs:"
echo "$BUILT_CONFIGS"
printf "%s\n" "${BUILT_CONFIGS[@]}"
echo
NEXTFLOW_SCHEMAS=()
for config_path in "${BUILT_CONFIGS[@]}"; do
dir=$(dirname "$config_path")
NEXTFLOW_SCHEMAS+=("$dir/nextflow_schema.json")
done
NEXTFLOW_SCHEMAS=$(echo "$BUILT_CONFIGS" | sed 's/.config.vsh.yaml/nextflow_schema.json/g')
echo "Building Nextflow schema files:"
echo "$NEXTFLOW_SCHEMAS"
printf "%s\n" "${NEXTFLOW_SCHEMAS[@]}"
echo
viash_tools/target/docker/nextflow/generate_schema/generate_schema \
--input "$(echo "$BUILT_CONFIGS" | paste -sd ";")" \
--output "$(echo "$NEXTFLOW_SCHEMAS" | paste -sd ";")" \
VIASH_VERSION=`viash -v | grep -oP 'viash \K[0-9.]+'`
IFS=. read -r major minor patch <<< $VIASH_VERSION
JOINED_CONFIGS=$(IFS=';'; printf '%s' "${BUILT_CONFIGS[*]}")
JOINED_SCHEMAS=$(IFS=';'; printf '%s' "${NEXTFLOW_SCHEMAS[*]}")
if (( "$major" > 0 )) || (( "$minor" >= 9 )); then
viash_tools/target/docker/nextflow/generate_schema_v9/generate_schema_v9 \
--input "$JOINED_CONFIGS" \
--output "$JOINED_SCHEMAS" \
$([[ "${{ inputs.enable_dataset_input }}" == "true" ]] && echo "--enable_dataset_input")
else
viash_tools/target/docker/nextflow/generate_schema/generate_schema \
--input "$JOINED_CONFIGS" \
--output "$JOINED_SCHEMAS" \
$([[ "${{ inputs.enable_dataset_input }}" == "true" ]] && echo "--enable_dataset_input")
fi

0 comments on commit b46ff03

Please sign in to comment.