shfmt -w globally

This commit is contained in:
Earl Warren 2024-08-07 08:31:33 +02:00
parent 4e207414d4
commit d5f66e4c0a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
27 changed files with 378 additions and 375 deletions

View file

@ -1,57 +1,57 @@
# Copyright 2024 The Forgejo Authors
# SPDX-License-Identifier: MIT
ACTIONS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ACTIONS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
function actions_verify_example() {
local example=$1
local example=$1
export HOST_PORT
export url=http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT}
export token=$(cat $DOT_FORGEJO_CURL/token)
export HOST_PORT
export url=http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT}
export token=$(cat $DOT_FORGEJO_CURL/token)
actions_cleanup_example_volume
actions_cleanup_example_volume
export example
export EXAMPLE_DIR=$ACTIONS_DIR/example-$example
export example
export EXAMPLE_DIR=$ACTIONS_DIR/example-$example
if test -f $EXAMPLE_DIR/setup.sh ; then
echo "============================ SETUP example-$example ==================="
bash -ex $EXAMPLE_DIR/setup.sh || return 1
fi
if test -f $EXAMPLE_DIR/setup.sh; then
echo "============================ SETUP example-$example ==================="
bash -ex $EXAMPLE_DIR/setup.sh || return 1
fi
if test -f $EXAMPLE_DIR/run.sh ; then
echo "============================ RUN example-$example ==================="
bash -ex $EXAMPLE_DIR/run.sh || return 1
else
forgejo-test-helper.sh run_workflow actions/example-$example $url root example-$example $example $token || return 1
fi
if test -f $EXAMPLE_DIR/run.sh; then
echo "============================ RUN example-$example ==================="
bash -ex $EXAMPLE_DIR/run.sh || return 1
else
forgejo-test-helper.sh run_workflow actions/example-$example $url root example-$example $example $token || return 1
fi
if test -f $EXAMPLE_DIR/teardown.sh ; then
echo "============================ TEARDOWN example-$example ==================="
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
fi
if test -f $EXAMPLE_DIR/teardown.sh; then
echo "============================ TEARDOWN example-$example ==================="
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
fi
actions_save_contexts $example
actions_save_contexts $example
}
function actions_save_contexts() {
local example="$1"
if test -d /srv/example/$example/contexts; then
mkdir -p /srv/contexts
rsync -av /srv/example/$example/contexts/ /srv/contexts/$example/
mkdir -p /srv/contexts
rsync -av /srv/example/$example/contexts/ /srv/contexts/$example/
fi
}
function actions_cleanup_example_volume() {
if test $(id -u) != 0 ; then
$SUDO chown $(id -u) /srv
if test $(id -u) != 0; then
$SUDO chown $(id -u) /srv
fi
if ! test -d /srv/example ; then
mkdir -p /srv/example
return
if ! test -d /srv/example; then
mkdir -p /srv/example
return
fi
$SUDO rm -fr /srv/example/*
@ -79,10 +79,10 @@ function actions_teardown() {
function actions_runner_version() {
local runner_version=$($DIR/forgejo-runner --version | sed -n -e 's/forgejo-runner version v//p')
if test -z "$runner_version" ; then
$DIR/forgejo-runner --version
echo failed to parse version
false
if test -z "$runner_version"; then
$DIR/forgejo-runner --version
echo failed to parse version
false
fi
echo $runner_version
}
@ -90,37 +90,37 @@ function actions_runner_version() {
function test_actions() {
local versions="${1:-1.21 $RELEASE_NUMBERS_AND_DEV}"
for version in $versions ; do
for version in $versions; do
actions_setup $version
local runner_version=$(actions_runner_version)
actions_setup $version
local runner_version=$(actions_runner_version)
log_info "Testing actions with Forgejo $version & Forgejo runner $runner_version"
log_info "Testing actions with Forgejo $version & Forgejo runner $runner_version"
if dpkg --compare-versions $version ge 7.0 && dpkg --compare-versions $runner_version gt 3.3.0 ; then
for example in artifacts-v4 ; do
run actions_verify_example $example
done
fi
for example in echo cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context ; do
run actions_verify_example $example
done
if dpkg --compare-versions $version lt 7.1 ; then
for example in cron ; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 7.1 ; then
for example in automerge post-7-0-schedule ; do
if dpkg --compare-versions $version ge 7.0 && dpkg --compare-versions $runner_version gt 3.3.0; then
for example in artifacts-v4; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 8.0 ; then
for example in workflow-dispatch ; do
for example in echo cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do
run actions_verify_example $example
done
if dpkg --compare-versions $version lt 7.1; then
for example in cron; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 7.1; then
for example in automerge post-7-0-schedule; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 8.0; then
for example in workflow-dispatch; do
run actions_verify_example $example
done
fi