Skip to content

Commit

Permalink
Take single OS in ci-runtests.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Oct 16, 2023
1 parent c93a10e commit 106ecd6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
1 change: 0 additions & 1 deletion .github/workflows/desktop-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- name: Run end-to-end tests
shell: bash -ieo pipefail {0}
env:
TEST_OSES: ${{ matrix.os }}
TAG: ${{ github.event.inputs.tag }}
run: |
./test/ci-runtests.sh ${{ matrix.os }}
Expand Down
56 changes: 27 additions & 29 deletions test/ci-runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ else
exit 1
fi

function print_usage {
echo "usage: $0 TEST_OS"
}

if [[ "$#" -lt 1 ]]; then
print_usage
exit 1
fi

TEST_OS=$1

# 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))]')
OLD_APP_VERSION=$(jq -r '[.[] | select(.prerelease==false)] | .[0].tag_name' <<<"$RELEASES")
Expand All @@ -40,14 +51,6 @@ echo "* Version to upgrade from: $OLD_APP_VERSION"
echo "* Version to test: $NEW_APP_VERSION"
echo "**********************************"

if [[ -z "${TEST_OSES+x}" ]]; then
echo "'TEST_OSES' must be specified" 1>&2
exit 1
fi

# Try to parse $TEST_OSES from the environment
# https://www.shellcheck.net/wiki/SC2206
IFS=" " read -r -a TEST_OSES <<< "${TEST_OSES:-}"

if [[ -z "${ACCOUNT_TOKENS+x}" ]]; then
echo "'ACCOUNT_TOKENS' must be specified" 1>&2
Expand Down Expand Up @@ -209,40 +212,35 @@ function run_tests_for_os {
}

echo "**********************************"
echo "* Building test runners"
echo "* Downloading app packages"
echo "**********************************"

mkdir -p $PACKAGES_DIR
nice_time download_app_package $OLD_APP_VERSION $TEST_OS || true
nice_time download_app_package $NEW_APP_VERSION $TEST_OS || true
nice_time download_e2e_executable $NEW_APP_VERSION $TEST_OS || true

echo "**********************************"
echo "* Building test runner"
echo "**********************************"

# Clean up packages. Try to keep ones that match the versions we're testing
# TODO(markus,david): REVERT
# find "$PACKAGES_DIR/" -type f ! \( -name "*${OLD_APP_VERSION}_*" -o -name "*${OLD_APP_VERSION}.*" -o -name "*${NEW_APP_VERSION}*" \) -delete || true

function build_test_runners {
# TODO: `TEST_OSES` does not need to be an array.
for os in "${TEST_OSES[@]}"; do
nice_time download_app_package $OLD_APP_VERSION $os || true
nice_time download_app_package $NEW_APP_VERSION $os || true
nice_time download_e2e_executable $NEW_APP_VERSION $os || true
done

function build_test_runner {
local targets=()
if [[ "${TEST_OSES[*]}" =~ "debian"|"ubuntu"|"fedora" ]]; then
if [[ "${TEST_OS}" =~ "debian"|"ubuntu"|"fedora" ]]; then
targets+=("x86_64-unknown-linux-gnu")
fi
if [[ "${TEST_OSES[*]}" =~ "windows" ]]; then
elif [[ "${TEST_OS}" =~ "windows" ]]; then
targets+=("x86_64-pc-windows-gnu")
fi
if [[ "${TEST_OSES[*]}" =~ "macos" ]]; then
elif [[ "${TEST_OS}" =~ "macos" ]]; then
targets+=("aarch64-apple-darwin")
fi

mkdir -p $PACKAGES_DIR

for target in "${targets[@]}"; do
TARGET=$target ./build.sh
done
TARGET=$target ./build.sh
}

nice_time build_test_runners
nice_time build_test_runner

echo "**********************************"
echo "* Building test manager"
Expand Down

0 comments on commit 106ecd6

Please sign in to comment.