diff --git a/.github/RELEASE.md b/.github/RELEASE.md index 97717e02..099d755a 100644 --- a/.github/RELEASE.md +++ b/.github/RELEASE.md @@ -3,6 +3,7 @@ This is a guide to know the steps to create a new release. 1. Update the version in [BASHUNIT_VERSION](../bashunit) +1. Update the version in [LATEST_BASHUNIT_VERSION](../install.sh) 1. Update the version in [CHANGELOG.md](../CHANGELOG.md) 1. Update the version in [package.json](../package.json) 1. Build the project `./build.sh bin` diff --git a/CHANGELOG.md b/CHANGELOG.md index c54ff575..eb17b52b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,14 +16,15 @@ - temp_dir - cleanup_temp_files - log -- Improved clean up temporal files and directories -- Improved CI test speed by running them in parallel - Add default env values: - `DEFAULT_PATH="tests"` - `LOG_PATH="out.log"` - `LOAD_FILE="tests/bootstrap.sh"` - Add check that git is installed to `install.sh` -- Display seconds on total time taken +- Improved time taken display +- Improved clean up temporal files and directories +- Improved CI test speed by running them in parallel +- Removed git dependency for stable installations ## [0.17.0](https://github.com/TypedDevs/bashunit/compare/0.16.0...0.17.0) - 2024-10-01 diff --git a/install.sh b/install.sh index 865b9f89..65c457f8 100755 --- a/install.sh +++ b/install.sh @@ -1,34 +1,27 @@ #!/bin/bash # shellcheck disable=SC2155 # shellcheck disable=SC2164 -# shellcheck disable=SC2103 -function check_git_is_installed() { +function build_and_install_beta() { + echo "> Downloading non-stable version: 'beta'" + if ! command -v git >/dev/null 2>&1; then echo "Error: git is not installed." >&2 exit 1 fi -} -function get_latest_tag() { - git ls-remote --tags "$BASHUNIT_GIT_REPO" | - awk '{print $2}' | - sed 's|^refs/tags/||' | - sort -Vr | - head -n 1 -} - -function build_and_install_beta() { - echo "> Downloading non-stable version: 'beta'" - git clone --depth 1 --no-tags https://github.com/TypedDevs/bashunit temp_bashunit 2>/dev/null + git clone --depth 1 --no-tags $BASHUNIT_GIT_REPO temp_bashunit 2>/dev/null cd temp_bashunit ./build.sh >/dev/null - local latest_commit - latest_commit=$(git rev-parse --short=8 HEAD) + local latest_commit=$(git rev-parse --short=7 HEAD) + # shellcheck disable=SC2103 cd .. - local beta_version - beta_version='(non-stable) beta after '"$LATEST_BASHUNIT_VERSION"' ['"$(date +'%Y-%m-%d')"'] 🐍 #'"$latest_commit" + local beta_version=$(printf "(non-stable) beta after %s [%s] 🐍 #%s" \ + "$LATEST_BASHUNIT_VERSION" \ + "$(date +'%Y-%m-%d')" \ + "$latest_commit" + ) sed -i -e 's/BASHUNIT_VERSION=".*"/BASHUNIT_VERSION="'"$beta_version"'"/g' temp_bashunit/bin/bashunit cp temp_bashunit/bin/bashunit ./ @@ -44,9 +37,9 @@ function install() { fi if command -v curl > /dev/null 2>&1; then - curl -L -O -J "https://github.com/TypedDevs/bashunit/releases/download/$TAG/bashunit" 2>/dev/null + curl -L -O -J "$BASHUNIT_GIT_REPO/releases/download/$TAG/bashunit" 2>/dev/null elif command -v wget > /dev/null 2>&1; then - wget "https://github.com/TypedDevs/bashunit/releases/download/$TAG/bashunit" 2>/dev/null + wget "$BASHUNIT_GIT_REPO/releases/download/$TAG/bashunit" 2>/dev/null else echo "Cannot download bashunit: curl or wget not found." fi @@ -57,13 +50,11 @@ function install() { ######### MAIN ########## ######################### -check_git_is_installed - DIR=${1-lib} VERSION=${2-latest} +LATEST_BASHUNIT_VERSION="0.17.0" BASHUNIT_GIT_REPO="https://github.com/TypedDevs/bashunit" -LATEST_BASHUNIT_VERSION="$(get_latest_tag)" TAG="$LATEST_BASHUNIT_VERSION" cd "$(dirname "$0")" diff --git a/tests/acceptance/install_test.sh b/tests/acceptance/install_test.sh index fb07ed65..25a1132b 100644 --- a/tests/acceptance/install_test.sh +++ b/tests/acceptance/install_test.sh @@ -67,7 +67,7 @@ function test_install_downloads_the_non_stable_beta_version() { "$output" assert_file_exists "$installed_bashunit" assert_matches\ - "$(printf "\(non-stable\) beta after ([0-9]+\.[0-9]+\.[0-9]+) \[2023-11-13\] 🐍 \#[a-fA-F0-9]{8}")"\ + "$(printf "\(non-stable\) beta after ([0-9]+\.[0-9]+\.[0-9]+) \[2023-11-13\] 🐍 \#[a-fA-F0-9]{7}")"\ "$("$installed_bashunit" --env "$TEST_ENV_FILE" --version)" assert_directory_not_exists "./deps/temp_bashunit" file_count_of_deps_directory=$(find ./deps -mindepth 1 -maxdepth 1 -print | wc -l | tr -d ' ')