blob: dd2758ebc3b5c50eb006fd847bc041c68dfdcd98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/usr/bin/env bash
set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR/.."
TARGET=${1:-$(rustc -vV | sed -n 's|host: ||p')}
PRODUCT_VERSION=$(cargo run -q --bin mullvad-version)
ASSETS=(
"build/src/config.json"
"build/src/renderer/lib/routes.js"
"build/test/e2e/utils.js"
"build/test/e2e/shared/*.js"
"build/test/e2e/installed/*.js"
"build/test/e2e/installed/**/*.js"
"node_modules/.bin/playwright"
"node_modules/playwright"
"node_modules/playwright-core"
"node_modules/@playwright/test"
)
function build_test_executable {
local pkg_target=$1
local bin_suffix=${2:-""}
local temp_dir
temp_dir="$(mktemp -d)"
local temp_executable="$temp_dir/temp-test-executable$bin_suffix"
local output="../dist/app-e2e-tests-$PRODUCT_VERSION-$TARGET$bin_suffix"
local node_copy_path="$temp_dir/node$bin_suffix"
local node_path
node_path="$(volta which node || which node)"
# pack assets
cp "$node_path" "$node_copy_path"
# shellcheck disable=SC2068
tar -czf ./build/test/assets.tar.gz ${ASSETS[@]}
cp "$node_copy_path" "$temp_executable"
node --experimental-sea-config standalone-tests.sea.json
# Inject SEA blob
case $pkg_target in
macos-*)
codesign --remove-signature "$temp_executable"
npx postject "$temp_executable" NODE_SEA_BLOB \
standalone-tests.sea.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
--macho-segment-name NODE_SEA
codesign --sign - "$temp_executable"
;;
*)
npx postject "$temp_executable" NODE_SEA_BLOB \
standalone-tests.sea.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
;;
esac
mkdir -p "$(dirname "$output")"
mv "$temp_executable" "$output"
rm -rf "$temp_dir"
}
case "$TARGET" in
"aarch64-unknown-linux-gnu")
build_test_executable linux-arm64
;;
"x86_64-unknown-linux-gnu")
build_test_executable linux-x64
;;
"aarch64-apple-darwin")
build_test_executable macos-arm64
;;
"x86_64-apple-darwin")
build_test_executable macos-x64
;;
"x86_64-pc-windows-msvc")
build_test_executable win-x64 .exe
;;
esac
|