diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-02-12 13:57:40 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-02-25 12:06:49 +0100 |
| commit | 28a0154b9b788cedead8fe47dcc1ac12a8af356b (patch) | |
| tree | 43abb5b8e44d696a1aae2ce00a5a479c79de4dcd /test/scripts/run | |
| parent | 5df6076543862e5f8c0ac0430f2774ecb9cd8362 (diff) | |
| download | mullvadvpn-28a0154b9b788cedead8fe47dcc1ac12a8af356b.tar.xz mullvadvpn-28a0154b9b788cedead8fe47dcc1ac12a8af356b.zip | |
Rename some scripts (and move them to subdirectories)
Start off with the download app package / e2e tests binary in
`download.sh`. Rename `test-utils.sh` to `lib.sh` & start to break up
`lib.sh`.
Diffstat (limited to 'test/scripts/run')
| -rwxr-xr-x | test/scripts/run/ci.sh | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/test/scripts/run/ci.sh b/test/scripts/run/ci.sh new file mode 100755 index 0000000000..b55b640e03 --- /dev/null +++ b/test/scripts/run/ci.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +# TODO: Break this down into multiple, smaller scripts and compose them in this file. + +set -eu + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_FRAMEWORK_ROOT="$SCRIPT_DIR/../.." +TEST_DIR="$TEST_FRAMEWORK_ROOT" + +cd "$SCRIPT_DIR" + +# Parse arguments +# TODO: Add support for either passing in --account-tokens or reading from env variable. +if [[ "$#" -lt 1 ]]; then + echo "usage: $0 TEST_OS" 1>&2 + exit 1 +fi + +TEST_OS=$1 + +if [[ "$(uname -s)" == "Darwin" ]]; then + # NOTE: We only do this on macOS since we use containers otherwise + echo "Updating Rust toolchain" + rustup update +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" +echo "* Version to test: $CURRENT_VERSION" +echo "**********************************" + +# TODO: Add support for either passing in --account-tokens or reading from env variable. +if [[ -z "${ACCOUNT_TOKENS+x}" ]]; then + echo "'ACCOUNT_TOKENS' must be specified" 1>&2 + exit 1 +fi +if ! readarray -t tokens < "${ACCOUNT_TOKENS}"; then + echo "Specify account numbers in 'ACCOUNT_TOKENS' file" 1>&2 + exit 1 +fi + +# TODO: Can we get rid of this? Seemse excessive / leaves a trail +CI_LOGS_DIR="$TEST_DIR/.ci-logs" +mkdir -p "$CI_LOGS_DIR" +echo "$CURRENT_VERSION" > "$CI_LOGS_DIR/last-version.log" + + +# TODO: This should def be it's own step in the GitHub actions workflow + +echo "**********************************" +echo "* Downloading app packages" +echo "**********************************" + + +nice_time download_app_package "$LATEST_STABLE_RELEASE" "$TEST_OS" +nice_time download_app_package "$CURRENT_VERSION" "$TEST_OS" +nice_time download_e2e_executable "$CURRENT_VERSION" "$TEST_OS" + +# TODO: This should def be it's own step in the GitHub actions workflow + +echo "**********************************" +echo "* Building test manager" +echo "**********************************" + +cargo build -p test-manager + +# TODO: This should def be it's own step in the GitHub actions workflow + +echo "**********************************" +echo "* Running tests" +echo "**********************************" + +# TODO: Should we really care about logging in this script? + +mkdir -p "$CI_LOGS_DIR/os/" +export TEST_REPORT="$CI_LOGS_DIR/${TEST_OS}_report" +rm -f "$TEST_REPORT" + +set -o pipefail + +APP_PACKAGE=$(get_app_filename "$CURRENT_VERSION" "$TEST_OS") +export APP_PACKAGE +APP_PACKAGE_TO_UPGRADE_FROM=$(get_app_filename "$LATEST_STABLE_RELEASE" "$TEST_OS") +export APP_PACKAGE_TO_UPGRADE_FROM +ACCOUNT_TOKEN=${tokens[0]} RUST_LOG=debug nice_time run_tests_for_os "${TEST_OS}" |
