diff options
| author | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2025-03-17 17:06:15 +0100 |
|---|---|---|
| committer | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2025-03-18 11:07:47 +0100 |
| commit | 460157baa27de254cc3cb2e74a6c541366cae0ac (patch) | |
| tree | 50e2e4e32c56e1550d49061310d8f63912651f98 /test/scripts | |
| parent | 33ddf7ac429dc51d722619529fb7369150bdf41b (diff) | |
| download | mullvadvpn-460157baa27de254cc3cb2e74a6c541366cae0ac.tar.xz mullvadvpn-460157baa27de254cc3cb2e74a6c541366cae0ac.zip | |
Delete `download.sh`
Diffstat (limited to 'test/scripts')
| -rwxr-xr-x | test/scripts/run/ci.sh | 2 | ||||
| -rwxr-xr-x | test/scripts/utils/download.sh | 192 |
2 files changed, 0 insertions, 194 deletions
diff --git a/test/scripts/run/ci.sh b/test/scripts/run/ci.sh index b1aff3a6e4..67f87f241c 100755 --- a/test/scripts/run/ci.sh +++ b/test/scripts/run/ci.sh @@ -27,8 +27,6 @@ fi # shellcheck source=test/scripts/utils/lib.sh source "../utils/lib.sh" -# shellcheck source=test/scripts/utils/download.sh -source "../utils/download.sh" # TODO: Do not source it, call it instead. echo "**********************************" echo "* Version to upgrade from: $LATEST_STABLE_RELEASE" diff --git a/test/scripts/utils/download.sh b/test/scripts/utils/download.sh deleted file mode 100755 index 3c0115bae6..0000000000 --- a/test/scripts/utils/download.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -export BUILD_RELEASE_REPOSITORY="https://releases.mullvad.net/desktop/releases" -export BUILD_DEV_REPOSITORY="https://releases.mullvad.net/desktop/builds" - -# Returns the directory of the lib.sh script -function get_test_utils_dir { - echo "$SCRIPT_DIR" -} - -# Infer stable version from GitHub repo -RELEASES=$(curl -sf https://api.github.com/repos/mullvad/mullvadvpn-app/releases | jq -r '[.[] | select(((.tag_name|(startswith("android") or startswith("ios"))) | not))]') -LATEST_STABLE_RELEASE=$(jq -r '[.[] | select(.prerelease==false)] | .[0].tag_name' <<<"$RELEASES") - -commit=$(git rev-parse HEAD^\{commit\}) -commit=${commit:0:6} - -TAG=$(git describe --exact-match HEAD 2>/dev/null || echo "") - -export LATEST_STABLE_RELEASE - -function print_available_releases { - for release in $(jq -r '.[].tag_name' <<<"$RELEASES"); do - echo "$release" - done -} - -function get_package_dir { - local package_dir - if [[ -n "${PACKAGE_DIR+x}" ]]; then - # Resolve the package dir to an absolute path since cargo must be invoked from the test directory - package_dir=$(realpath "$PACKAGE_DIR") - elif [[ ("$(uname -s)" == "Darwin") ]]; then - package_dir="$HOME/Library/Caches/mullvad-test/packages" - elif [[ ("$(uname -s)" == "Linux") ]]; then - package_dir="$HOME/.cache/mullvad-test/packages" - else - echo "Unsupported OS" 1>&2 - exit 1 - fi - - mkdir -p "$package_dir" || exit 1 - # Clean up old packages - find "$package_dir" -type f -mtime +5 -delete || true - - echo "$package_dir" - return 0 -} - -function nice_time { - SECONDS=0 - if "$@"; then - result=0 - else - result=$? - fi - s=$SECONDS - echo "\"$*\" completed in $((s / 60))m:$((s % 60))s" - return $result -} -# Matches $1 with a build version string and sets the following exported variables: -# - BUILD_VERSION: The version part of the build string (e.g., "2024.3-beta1-dev-"). -# - COMMIT_HASH: The commit hash part of the build string (e.g., "abcdef"). -# - TAG: The tag part of the build string (e.g., "+tag"). -function parse_build_version { - if [[ "$1" =~ (^[0-9.]+(-beta[0-9]+)?-dev-)([0-9a-z]+)(\+[0-9a-z|-]+)?$ ]]; then - BUILD_VERSION="${BASH_REMATCH[1]}" - COMMIT_HASH="${BASH_REMATCH[3]}" - TAG="${BASH_REMATCH[4]}" - return 0 - fi - return 1 -} - -# Returns 0 if $1 is a development build. -function is_dev_version { - if [[ "$1" == *"-dev-"* ]]; then - return 0 - fi - return 1 -} - -function get_app_filename { - local version=$1 - local os=$2 - if is_dev_version "$version"; then - parse_build_version "$version" - version="${BUILD_VERSION}${COMMIT_HASH}${TAG:-}" - fi - case $os in - debian* | ubuntu*) - echo "MullvadVPN-${version}_amd64.deb" - ;; - fedora*) - echo "MullvadVPN-${version}_x86_64.rpm" - ;; - windows*) - echo "MullvadVPN-${version}.exe" - ;; - macos*) - echo "MullvadVPN-${version}.pkg" - ;; - *) - echo "Unsupported target: $os" 1>&2 - return 1 - ;; - esac -} - -function download_app_package { - local version=$1 - local os=$2 - local package_repo="" - - if is_dev_version "$version"; then - package_repo="${BUILD_DEV_REPOSITORY}" - else - package_repo="${BUILD_RELEASE_REPOSITORY}" - fi - - local filename - filename=$(get_app_filename "$version" "$os") - local url="${package_repo}/$version/$filename" - - local package_dir - package_dir=$(get_package_dir) - if [[ ! -f "$package_dir/$filename" ]]; then - echo "Downloading build for $version ($os) from $url" - if ! curl -sf -o "$package_dir/$filename" "$url"; then - echo "Failed to download package from $url (hint: build may not exist, check the url)" 1>&2 - exit 1 - fi - else - echo "App package for version $version ($os) already exists at $package_dir/$filename, skipping download" - fi -} - -function get_e2e_filename { - local version=$1 - local os=$2 - if is_dev_version "$version"; then - parse_build_version "$version" - version="${BUILD_VERSION}${COMMIT_HASH}" - fi - case $os in - debian* | ubuntu* | fedora*) - echo "app-e2e-tests-${version}-x86_64-unknown-linux-gnu" - ;; - windows*) - echo "app-e2e-tests-${version}-x86_64-pc-windows-msvc.exe" - ;; - macos*) - echo "app-e2e-tests-${version}-aarch64-apple-darwin" - ;; - *) - echo "Unsupported target: $os" 1>&2 - return 1 - ;; - esac -} - -function download_e2e_executable { - local version=${1:?Error: version not set} - local os=${2:?Error: os not set} - local package_repo - - if is_dev_version "$version"; then - package_repo="${BUILD_DEV_REPOSITORY}" - else - package_repo="${BUILD_RELEASE_REPOSITORY}" - fi - - local filename - filename=$(get_e2e_filename "$version" "$os") - local url="${package_repo}/$version/additional-files/$filename" - - local package_dir - package_dir=$(get_package_dir) - if [[ ! -f "$package_dir/$filename" ]]; then - echo "Downloading e2e executable for $version ($os) from $url" - if ! curl -sf -o "$package_dir/$filename" "$url"; then - echo "Failed to download package from $url (hint: build may not exist, check the url)" 1>&2 - exit 1 - fi - else - echo "GUI e2e executable for version $version ($os) already exists at $package_dir/$filename, skipping download" - fi -} |
