Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build nextflow schemas and params with viash 0.9 #41

Merged
merged 25 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* `.github/workflows/test.yaml`: Added a callable workflow for testing Viash components (PR #38).

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

## Minor changes

* `project/detect-changed-components`: Simplify separator handling of changed files array (PR #40).
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