Skip to content

Commit ead9408

Browse files
authored
chore(ci): make less verbose (#680)
1 parent 4255858 commit ead9408

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

scripts/build.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ function ionos.wordpress.build_workspace_package_docker() {
176176
pnpm --filter "$PACKAGE_NAME" --if-present run build
177177
pnpm --filter "$PACKAGE_NAME" --if-present run postbuild
178178
179+
[[ "$VERBOSE" == "yes" ]] && DOCKER_BUILD_VERBOSE='plain' || DOCKER_BUILD_VERBOSE='quiet'
179180
# image labels : see https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
180181
docker build \
181182
$(test -f $path/.env && cat $path/.env | sed 's/^/--build-arg /' ||:) \
182-
--progress=plain \
183+
--progress=$DOCKER_BUILD_VERBOSE \
183184
-t $DOCKER_IMAGE_NAME:latest \
184185
-t $DOCKER_IMAGE_NAME:$PACKAGE_VERSION \
185186
--label "maintainer=$DOCKER_IMAGE_AUTHOR" \
@@ -367,6 +368,8 @@ EOF
367368
done
368369
done
369370

371+
ionos.wordpress.log_info "generate localization files with wp-cli for plugin $PLUGIN_NAME"
372+
370373
# update po files
371374
ionos.wordpress.build_workspace_package_wp_plugin.wp_cli i18n update-po $LANGUAGES_DIR/*.pot
372375

@@ -415,7 +418,7 @@ EOF
415418
<(sed -e '/^".*$/d' -e 's/^\(#:.*\):[0-9]\+/\1/g' $po_file) \
416419
<(git show HEAD:$po_file 2>/dev/null | sed -e '/^".*$/d' -e 's/^\(#:.*\):[0-9]\+/\1/g') \
417420
|| diff_error_code=$?
418-
[[ "0" == "$diff_error_code" ]] && git checkout $po_file
421+
[[ "0" == "$diff_error_code" ]] && git checkout $po_file --quiet
419422
done
420423
else
421424
ionos.wordpress.log_warn "processing i18n skipped : env variable WP_CLI_I18N_LOCALES not set or not enabled by --use"
@@ -429,7 +432,9 @@ EOF
429432
if [[ "${USE[@]}" =~ all|wp-plugin:rector|wp-plugin:bundle ]]; then
430433
# copy plugin code to dist/[plugin-name]
431434
mkdir -p $path/dist/$plugin_name-$PACKAGE_VERSION
432-
rsync -rupE --verbose \
435+
ionos.wordpress.log_info "syncing plugin files to $path/dist/$plugin_name-$PACKAGE_VERSION"
436+
[[ "$VERBOSE" == "yes" ]] && RSYNC_VERBOSE='--verbose' || RSYNC_VERBOSE='--quiet'
437+
rsync -rupE $RSYNC_VERBOSE \
433438
--exclude=node_modules/ \
434439
--exclude=package.json \
435440
--exclude=dist/ \
@@ -449,21 +454,23 @@ EOF
449454
$(test -f $path/.distignore && echo "--exclude-from=$path/.distignore") \
450455
$path/ \
451456
$path/dist/$plugin_name-$PACKAGE_VERSION
457+
ionos.wordpress.log_info "syncing plugin files done"
452458
fi
453459

454460
if [[ "${USE[@]}" =~ all|wp-plugin:rector ]]; then
455461
(
456462
# we wrap the loop in a subshell call because of the nullglob shell behaviour change
457463
# nullglob is needed because we want to skip the loop if no rector-config-php*.php files are found
458464
shopt -s nullglob
459-
465+
ionos.wordpress.log_info "running rector for plugin $plugin_name"
466+
[[ "$VERBOSE" == "yes" ]] && RECTOR_VERBOSE='' || RECTOR_VERBOSE='--no-diffs'
460467
# process plugin using rector
461468
for RECTOR_CONFIG in ./packages/docker/rector-php/rector-config-php*.php; do
462469
RECTOR_CONFIG=$(basename "$RECTOR_CONFIG" '.php')
463470
TARGET_PHP_VERSION="${RECTOR_CONFIG#*rector-config-php}"
464471
TARGET_DIR="dist/${plugin_name}-${PACKAGE_VERSION}-php${TARGET_PHP_VERSION}/${plugin_name}"
465472
mkdir -p $path/$TARGET_DIR
466-
rsync -a $path/dist/${plugin_name}-$PACKAGE_VERSION/ $path/$TARGET_DIR
473+
rsync -a --quiet $path/dist/${plugin_name}-$PACKAGE_VERSION/ $path/$TARGET_DIR
467474
# call dockerized rector
468475
docker run \
469476
$DOCKER_FLAGS \
@@ -475,6 +482,7 @@ EOF
475482
--clear-cache \
476483
--config "${RECTOR_CONFIG}.php" \
477484
--no-progress-bar \
485+
${RECTOR_VERBOSE} \
478486
process \
479487
dist
480488

@@ -499,10 +507,9 @@ EOF
499507
done
500508
cat << EOF | tee $path/build-info
501509
$(cd $path/dist && ls -1shS *.zip 2>/dev/null || echo "no zip archives found")
502-
503-
$(echo -n "---")
504-
505-
$(for ZIP_ARCHIVE in $(find $path/dist/ -name '*.zip'); do (cd $(dirname $ZIP_ARCHIVE) && unzip -l $(basename $ZIP_ARCHIVE) && echo ""); done)
510+
$(if [[ "$VERBOSE" == "yes" ]]; then
511+
for ZIP_ARCHIVE in $(find $path/dist/ -name '*.zip'); do (cd $(dirname $ZIP_ARCHIVE) && unzip -l $(basename $ZIP_ARCHIVE) && echo ""); done
512+
fi)
506513
EOF
507514
fi
508515

0 commit comments

Comments
 (0)