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

Fix update version awk shebang #82

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up JDK 17
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/[email protected]
with:
distribution: ${{ env.JAVA_DISTRO }}
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up JDK 17
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/[email protected]
with:
distribution: ${{ env.JAVA_DISTRO }}
Expand Down
24 changes: 12 additions & 12 deletions etc/scripts/checkstyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ set -o errtrace || true # trace ERR through commands and functions
set -o errexit || true # exit the script if any statement returns a non-true return value

on_error(){
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
}
trap on_error ERR

# Path to this script
if [ -h "${0}" ] ; then
SCRIPT_PATH="$(readlink "${0}")"
SCRIPT_PATH="$(readlink "${0}")"
else
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
fi
readonly SCRIPT_PATH

Expand All @@ -54,10 +54,10 @@ rm -f "${WS_DIR}"/target/checkstyle-*

# shellcheck disable=SC2086
mvn ${MAVEN_ARGS} checkstyle:checkstyle-aggregate \
-f "${WS_DIR}"/pom.xml \
-Dcheckstyle.output.format="plain" \
-Dcheckstyle.output.file="${RESULT_FILE}" \
> ${LOG_FILE} 2>&1 || (cat ${LOG_FILE} ; exit 1)
-f "${WS_DIR}"/pom.xml \
-Dcheckstyle.output.format="plain" \
-Dcheckstyle.output.file="${RESULT_FILE}" \
> ${LOG_FILE} 2>&1 || (cat ${LOG_FILE} ; exit 1)

grep "^\[ERROR\]" "${RESULT_FILE}" \
&& die "CHECKSTYLE ERROR" || echo "CHECKSTYLE OK"
&& die "CHECKSTYLE ERROR" || echo "CHECKSTYLE OK"
26 changes: 13 additions & 13 deletions etc/scripts/copyright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ set -o errtrace || true # trace ERR through commands and functions
set -o errexit || true # exit the script if any statement returns a non-true return value

on_error(){
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
}
trap on_error ERR

# Path to this script
if [ -h "${0}" ] ; then
SCRIPT_PATH="$(readlink "${0}")"
SCRIPT_PATH="$(readlink "${0}")"
else
SCRIPT_PATH="${0}"
SCRIPT_PATH="${0}"
fi
readonly SCRIPT_PATH

Expand All @@ -50,12 +50,12 @@ die() { echo "${1}" ; exit 1 ;}

# shellcheck disable=SC2086
mvn ${MAVEN_ARGS} \
-N -f ${WS_DIR}/pom.xml \
-Dhelidon.enforcer.output.file="${RESULT_FILE}" \
-Dhelidon.enforcer.rules=copyright \
-Dhelidon.enforcer.failOnError=false \
-Pcopyright \
validate > ${LOG_FILE} 2>&1 || (cat ${LOG_FILE} ; exit 1)
-N -f ${WS_DIR}/pom.xml \
-Dhelidon.enforcer.output.file="${RESULT_FILE}" \
-Dhelidon.enforcer.rules=copyright \
-Dhelidon.enforcer.failOnError=false \
-Pcopyright \
validate > ${LOG_FILE} 2>&1 || (cat ${LOG_FILE} ; exit 1)

grep "^\[ERROR\]" "${RESULT_FILE}" \
&& die "COPYRIGHT ERROR" || echo "COPYRIGHT OK"
&& die "COPYRIGHT ERROR" || echo "COPYRIGHT OK"
14 changes: 7 additions & 7 deletions etc/scripts/dependency-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ set -o errexit || true # exit the script if any statement returns a non-true re

# Path to this script
if [ -h "${0}" ] ; then
SCRIPT_PATH="$(readlink "${0}")"
SCRIPT_PATH="$(readlink "${0}")"
else
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
fi
readonly SCRIPT_PATH

Expand All @@ -33,10 +33,10 @@ readonly SCRIPT_PATH
WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)

on_error(){
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
}
trap on_error ERR

Expand Down
22 changes: 11 additions & 11 deletions etc/scripts/prime-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

set -x

set -o pipefail || true # trace ERR through pipes
set -o errtrace || true # trace ERR through commands and functions
set -o errexit || true # exit the script if any statement returns a non-true return value
Expand All @@ -41,8 +43,6 @@ readonly SCRIPT_PATH
WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)
readonly WS_DIR

readonly HELIDON_REPO=https://github.com/helidon-io/helidon

version() {
awk 'BEGIN {FS="[<>]"} ; /<helidon.version>/ {print $3; exit 0}' "${1}"
}
Expand All @@ -58,21 +58,20 @@ echo "HELIDON_VERSION=${HELIDON_VERSION}"
# If it is not a SNAPSHOT version then we are using a released version of Helidon and
# do not want to prime
if [[ ! ${HELIDON_VERSION} == *-SNAPSHOT ]]; then
echo "Helidon version ${HELIDON_VERSION} is not a SNAPSHOT version. Skipping priming build."
exit 0
echo "Helidon version ${HELIDON_VERSION} is not a SNAPSHOT version. Skipping priming build."
exit 0
fi

cd "$(mktemp -d)"

git clone ${HELIDON_REPO} --branch ${HELIDON_BRANCH} --single-branch --depth 1
cd helidon
git clone https://github.com/helidon-io/helidon --branch ${HELIDON_BRANCH} --single-branch --depth 1

HELIDON_VERSION_IN_REPO=$(version bom/pom.xml)
HELIDON_VERSION_IN_REPO=$(version helidon/bom/pom.xml)
readonly HELIDON_VERSION_IN_REPO

if [ "${HELIDON_VERSION}" != "${HELIDON_VERSION_IN_REPO}" ]; then
echo "ERROR: Examples Helidon version ${HELIDON_VERSION} does not match version in Helidon repo ${HELIDON_VERSION_IN_REPO}"
exit 1
echo "ERROR: Examples Helidon version ${HELIDON_VERSION} does not match version in Helidon repo ${HELIDON_VERSION_IN_REPO}"
exit 1
fi

# shellcheck disable=SC2086
Expand All @@ -81,7 +80,8 @@ mvn ${MAVEN_ARGS} --version
echo "Building Helidon version ${HELIDON_VERSION} from Helidon repo branch ${HELIDON_BRANCH}"

# shellcheck disable=SC2086
mvn ${MAVEN_ARGS} \
mvn ${MAVEN_ARGS} -T8 \
-f helidon/pom.xml \
-DskipTests \
-Dmaven.test.skip=true \
clean install
install
56 changes: 28 additions & 28 deletions etc/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ set -o errtrace || true # trace ERR through commands and functions
set -o errexit || true # exit the script if any statement returns a non-true return value

on_error(){
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
}
trap on_error ERR

# Path to this script
if [ -h "${0}" ] ; then
SCRIPT_PATH="$(readlink "${0}")"
SCRIPT_PATH="$(readlink "${0}")"
else
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
fi
readonly SCRIPT_PATH

Expand All @@ -52,33 +52,33 @@ readonly HELIDON_VERSION
echo "HELIDON_VERSION=${HELIDON_VERSION}"

release_build(){
echo "Starting release build for ${HELIDON_VERSION}"
echo "Starting release build for ${HELIDON_VERSION}"

# Branch we will push this release to
local LATEST_BRANCH="helidon-4.x"
# Branch we will push this release to
local LATEST_BRANCH="helidon-4.x"

if [[ ${HELIDON_VERSION} == *-SNAPSHOT ]]; then
echo "Helidon version ${HELIDON_VERSION} is a SNAPSHOT version and not a released version. Failing release."
exit 1
fi
if [[ ${HELIDON_VERSION} == *-SNAPSHOT ]]; then
echo "Helidon version ${HELIDON_VERSION} is a SNAPSHOT version and not a released version. Failing release."
exit 1
fi

# Merge this branch (based on dev-4.x) with the
# helidon-4.x branch to ensure helidon-4.x has
# valid history when we push all this to it.
git fetch origin
git merge -s ours --no-ff origin/${LATEST_BRANCH}
# Merge this branch (based on dev-4.x) with the
# helidon-4.x branch to ensure helidon-4.x has
# valid history when we push all this to it.
git fetch origin
git merge -s ours --no-ff origin/${LATEST_BRANCH}

# Create and push a git tag
git tag -f "${HELIDON_VERSION}"
git push --force origin refs/tags/"${HELIDON_VERSION}":refs/tags/"${HELIDON_VERSION}"
# Create and push a git tag
git tag -f "${HELIDON_VERSION}"
git push --force origin refs/tags/"${HELIDON_VERSION}":refs/tags/"${HELIDON_VERSION}"

# Update helidon-4.x branch with this release
git push origin HEAD:${LATEST_BRANCH}
# Update helidon-4.x branch with this release
git push origin HEAD:${LATEST_BRANCH}

echo "======================"
echo "Created tag: ${HELIDON_VERSION}"
echo "Updated branch: ${LATEST_BRANCH}"
echo "======================"
echo "======================"
echo "Created tag: ${HELIDON_VERSION}"
echo "Updated branch: ${LATEST_BRANCH}"
echo "======================"
}

release_build
24 changes: 12 additions & 12 deletions etc/scripts/shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ readonly CACHE_DIR
# Caching the shellcheck
mkdir -p "${CACHE_DIR}"
if [ ! -e "${CACHE_DIR}/${VERSION}/shellcheck" ] ; then
ARCH=$(uname -m | tr "[:upper:]" "[:lower:]")
PLATFORM=$(uname -s | tr "[:upper:]" "[:lower:]")
curl -Lso "${CACHE_DIR}/sc.tar.xz" "${BASE_URL}/v${VERSION}/shellcheck-v${VERSION}.${PLATFORM}.${ARCH}.tar.xz"
tar -xf "${CACHE_DIR}/sc.tar.xz" -C "${CACHE_DIR}"
mkdir "${CACHE_DIR}/${VERSION}"
mv "${CACHE_DIR}/shellcheck-v${VERSION}/shellcheck" "${CACHE_DIR}/${VERSION}/shellcheck"
rm -rf "${CACHE_DIR}/shellcheck-v${VERSION}" "${CACHE_DIR}/sc.tar.xz"
ARCH=$(uname -m | tr "[:upper:]" "[:lower:]")
PLATFORM=$(uname -s | tr "[:upper:]" "[:lower:]")
curl -Lso "${CACHE_DIR}/sc.tar.xz" "${BASE_URL}/v${VERSION}/shellcheck-v${VERSION}.${PLATFORM}.${ARCH}.tar.xz"
tar -xf "${CACHE_DIR}/sc.tar.xz" -C "${CACHE_DIR}"
mkdir "${CACHE_DIR}/${VERSION}"
mv "${CACHE_DIR}/shellcheck-v${VERSION}/shellcheck" "${CACHE_DIR}/${VERSION}/shellcheck"
rm -rf "${CACHE_DIR}/shellcheck-v${VERSION}" "${CACHE_DIR}/sc.tar.xz"
fi
export PATH="${CACHE_DIR}/${VERSION}:${PATH}"

Expand All @@ -43,11 +43,11 @@ shellcheck --version
status_code=0
# shellcheck disable=SC2044
for file in $(find . -name "*.sh") ; do
# only check tracked files
if git ls-files --error-unmatch "${file}" > /dev/null 2>&1 ; then
printf "\n-- Checking file: %s --\n" "${file}"
shellcheck "${file}" || status_code=${?}
fi
# only check tracked files
if git ls-files --error-unmatch "${file}" > /dev/null 2>&1 ; then
printf "\n-- Checking file: %s --\n" "${file}"
shellcheck "${file}" || status_code=${?}
fi
done

exit ${status_code}
14 changes: 7 additions & 7 deletions etc/scripts/spotbugs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ set -o errtrace || true # trace ERR through commands and functions
set -o errexit || true # exit the script if any statement returns a non-true return value

on_error(){
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
CODE="${?}" && \
set +x && \
printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \
"${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}"
}
trap on_error ERR

# Path to this script
if [ -h "${0}" ] ; then
SCRIPT_PATH="$(readlink "${0}")"
SCRIPT_PATH="$(readlink "${0}")"
else
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
# shellcheck disable=SC155
SCRIPT_PATH="${0}"
fi
readonly SCRIPT_PATH

Expand Down
2 changes: 1 addition & 1 deletion etc/scripts/update-version.awk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env awk -f
#!/usr/bin/env -S awk -f
#
# Copyright (c) 2023, 2024 Oracle and/or its affiliates.
#
Expand Down