Skip to content

Commit da97137

Browse files
committed
Move CURRENT_VERSION out of lib.sh
1 parent f00f4a5 commit da97137

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

test/scripts/run/ci.sh

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env bash
22

3+
# This script is invoked by the GitHub workflow file below to launch the desktop end to end test framwork.
4+
# <https://github.com/mullvad/mullvadvpn-app/blob/main/.github/workflows/desktop-e2e.yml>
5+
36
# TODO: Break this down into multiple, smaller scripts and compose them in this file.
47

58
set -eu
@@ -28,6 +31,15 @@ fi
2831
# shellcheck source=test/scripts/utils/lib.sh
2932
source "../utils/lib.sh"
3033

34+
# The `CURRENT_VERSION` variable is set by the workflow file which invokes `mullvad-version`
35+
# We need to add a suffix with tag information to get the current version string
36+
TAG=$(git describe --exact-match HEAD 2>/dev/null || echo "")
37+
if [[ -n "$TAG" && ${CURRENT_VERSION} =~ -dev- ]]; then
38+
# Remove disallowed version characters from the tag
39+
CURRENT_VERSION+="+${TAG//[^0-9a-z_-]/}"
40+
fi
41+
export CURRENT_VERSION
42+
3143
echo "**********************************"
3244
echo "* Version to upgrade from: $LATEST_STABLE_RELEASE"
3345
echo "* Version to test: $CURRENT_VERSION"

test/scripts/utils/lib.sh

+6-10
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ LATEST_STABLE_RELEASE=$(jq -r '[.[] | select(.prerelease==false)] | .[0].tag_nam
2626
commit=$(git rev-parse HEAD^\{commit\})
2727
commit=${commit:0:6}
2828

29-
TAG=$(git describe --exact-match HEAD 2>/dev/null || echo "")
30-
31-
if [[ -n "$TAG" && ${CURRENT_VERSION} =~ -dev- ]]; then
32-
# Remove disallowed version characters from the tag
33-
CURRENT_VERSION+="+${TAG//[^0-9a-z_-]/}"
34-
fi
35-
36-
export CURRENT_VERSION
3729
export LATEST_STABLE_RELEASE
3830

3931
function print_available_releases {
@@ -250,15 +242,19 @@ function run_tests_for_os {
250242
function build_current_version {
251243
local app_dir
252244
app_dir="$REPO_ROOT"
245+
local current_version
246+
pushd "$app_dir"
247+
current_version=$(cargo run --package mullvad-version)
248+
popd
253249
local app_filename
254250
# TODO: TEST_OS must be set to local OS manually, should be set automatically
255-
app_filename=$(get_app_filename "$CURRENT_VERSION" "${TEST_OS:?Error: TEST_OS not set}")
251+
app_filename=$(get_app_filename "$current_version" "${TEST_OS:?Error: TEST_OS not set}")
256252
local package_dir
257253
package_dir=$(get_package_dir)
258254
local app_package="$package_dir"/"$app_filename"
259255

260256
local gui_test_filename
261-
gui_test_filename=$(get_e2e_filename "$CURRENT_VERSION" "$TEST_OS")
257+
gui_test_filename=$(get_e2e_filename "$current_version" "$TEST_OS")
262258
local gui_test_bin="$package_dir"/"$gui_test_filename"
263259

264260
if [ ! -f "$app_package" ]; then

0 commit comments

Comments
 (0)