summaryrefslogtreecommitdiffhomepage
path: root/gui/scripts/build-test-executable.sh
blob: 273e1d4920b693a8ef1dac67f724e1288f8fd251 (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
#!/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)

function build_test_executable {
    local pkg_target=$1
    local suffix=${2:-""}
    local output="../dist/app-e2e-tests-$PRODUCT_VERSION-$TARGET$suffix"

    npm exec pkg -- \
        --config standalone-tests.pkg.json \
        --targets "$pkg_target" \
        --output "$output" \
        build/standalone-tests.js
}

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