Skip to content

Commit cb283ab

Browse files
The greatest hack of all time
1 parent ac00a2b commit cb283ab

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

.github/workflows/desktop-e2e.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,8 @@ jobs:
135135
steps:
136136
- name: Checkout repository
137137
uses: actions/checkout@v4
138-
# - name: Setup Docker
139-
# uses: crazy-max/ghaction-setup-docker@v3
140138
- name: Build test framework
141139
working-directory: test
142-
# env:
143-
# CONTAINER_RUNNER: docker
144140
run: ./scripts/container-run.sh ./scripts/build.sh
145141
- uses: actions/upload-artifact@v3
146142
with:
@@ -169,6 +165,11 @@ jobs:
169165
path: ~/.cache/mullvad-test/packages
170166
- name: Checkout repository
171167
uses: actions/checkout@v4
168+
- uses: actions/download-artifact@v3
169+
if: ${{ needs.test-framework-linux.result == 'success' }}
170+
with:
171+
name: test-framework-linux
172+
path: ./test/dist
172173
- name: Run end-to-end tests
173174
shell: bash -ieo pipefail {0}
174175
run: |

test/scripts/ci-runtests.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ nice_time download_app_package "$LATEST_STABLE_RELEASE" "$TEST_OS"
4444
nice_time download_app_package "$CURRENT_VERSION" "$TEST_OS"
4545
nice_time download_e2e_executable "$CURRENT_VERSION" "$TEST_OS"
4646

47-
echo "**********************************"
48-
echo "* Building test manager"
49-
echo "**********************************"
50-
51-
cargo build -p test-manager
52-
53-
echo "**********************************"
54-
echo "* Running tests"
55-
echo "**********************************"
47+
# TMP: Assume test-manager has been built already!
48+
# If we are testing Linux, spood that we compile test-manager and test-runner. Actually use-precompiled artifacts.
49+
if ! is_linux "$TEST_OS" ; then
50+
echo "**********************************"
51+
echo "* Building test manager"
52+
echo "**********************************"
53+
54+
cargo build -p test-manager
55+
fi
5656

5757
mkdir -p "$CI_LOGS_DIR/os/"
5858
export TEST_REPORT="$CI_LOGS_DIR/${TEST_OS}_report"

test/scripts/test-utils.sh

+25-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ LATEST_STABLE_RELEASE=$(jq -r '[.[] | select(.prerelease==false)] | .[0].tag_nam
2424
function get_current_version {
2525
local app_dir
2626
app_dir="$(get_test_utls_dir)/../.."
27-
cargo run -q --manifest-path="$app_dir/Cargo.toml" --bin mullvad-version
27+
# HACK:
28+
echo "2024.4-dev-7781ac"
29+
# cargo run -q --manifest-path="$app_dir/Cargo.toml" --bin mullvad-version
2830
}
2931

3032
CURRENT_VERSION=$(get_current_version)
@@ -150,6 +152,13 @@ function download_app_package {
150152
fi
151153
}
152154

155+
function is_linux {
156+
case $1 in
157+
debian*|ubuntu*|fedora*) true ;;
158+
*) false ;;
159+
esac
160+
}
161+
153162
function get_e2e_filename {
154163
local version=$1
155164
local os=$2
@@ -224,11 +233,15 @@ function run_tests_for_os {
224233
exit 1
225234
fi
226235

227-
echo "**********************************"
228-
echo "* Building test runner"
229-
echo "**********************************"
236+
# TMP: Assume test-manager has been built already!
237+
# If we are testing Linux, spood that we compile test-manager and test-runner. Actually use-precompiled artifacts.
238+
if ! is_linux "$TEST_OS" ; then
239+
echo "**********************************"
240+
echo "* Building test runner"
241+
echo "**********************************"
230242

231-
nice_time build_test_runner "$vm"
243+
nice_time build_test_runner "$vm"
244+
fi
232245

233246

234247
echo "**********************************"
@@ -255,7 +268,11 @@ function run_tests_for_os {
255268
local test_dir
256269
test_dir=$(get_test_utls_dir)/..
257270
pushd "$test_dir"
258-
if ! RUST_LOG_STYLE=always cargo run --bin test-manager \
271+
TEST_MANAGER_BIN="cargo run --bin test-manager"
272+
if is_linux "$vm" ; then
273+
TEST_MANAGER_BIN="./dist/test-manager"
274+
fi
275+
if ! RUST_LOG_STYLE=always "$TEST_MANAGER_BIN" \
259276
run-tests \
260277
--account "${ACCOUNT_TOKEN:?Error: ACCOUNT_TOKEN not set}" \
261278
--app-package "${APP_PACKAGE:?Error: APP_PACKAGE not set}" \
@@ -278,7 +295,7 @@ function build_current_version {
278295
app_dir="$(get_test_utls_dir)/../.."
279296
local app_filename
280297
# TODO: TEST_OS must be set to local OS manually, should be set automatically
281-
app_filename=$(get_app_filename "$CURRENT_VERSION" "${TEST_OS:?Error: TEST_OS not set}")
298+
app_filename=$(get_app_filename "$CURRENT_VERSION" "${TEST_OS:?Error: TEST_OS not set}")
282299
local package_dir
283300
package_dir=$(get_package_dir)
284301
local app_package="$package_dir"/"$app_filename"
@@ -309,4 +326,4 @@ function build_current_version {
309326
else
310327
echo "GUI e2e executable for current version already exists at $gui_test_bin, skipping build"
311328
fi
312-
}
329+
}

0 commit comments

Comments
 (0)