From 8b97ce295446c6aebed652a9ae623d22c7e1ca08 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 23 Mar 2021 13:26:31 -0700 Subject: [PATCH] Add integration test script Summary: Following priteshrnandgaonkar's advice of having something a little more automated for testing the entire flow. This builds for each platform and runs a little smoke test, ensuring that the right files are in each archive. Reviewed By: priteshrnandgaonkar Differential Revision: D27229200 fbshipit-source-id: d83881a948ae001ce2379e9db5e21b777a5fe922 --- packer/test-run.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 packer/test-run.sh diff --git a/packer/test-run.sh b/packer/test-run.sh new file mode 100755 index 000000000..a2f61e3b2 --- /dev/null +++ b/packer/test-run.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +echo "Starting a manual test run ..." + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +DIST_DIR="$DIR/../dist" + +if [[ ! -d $DIST_DIR/mac || ! -d $DIST_DIR/linux-unpacked || ! -d $DIST_DIR/win-unpacked ]]; then + echo "ERR: Needs distributions built for Mac, Linux and Windows." + echo "Please run in this in the desktop directory:" + echo "$ yarn build --mac --linux --win" + exit 1 +fi + +has_resources() { + if ! tar tf "$1" | grep '[Rr]esources/app.asar' > /dev/null; then + echo "ERR: $1 for $2 does not contain a resource bundle. Check your packfile!" + exit 2 + fi +} + +has_no_resources() { + if (( $(tar tf "$1" | grep -cFv '[Rr]esources/app.asar') < 10 )); then + echo "ERR: $1 for $2 has suspiciously low number of non-resource files. Check your packfile!" + exit 2 + fi +} + +echo "Build for Mac ..." + +cargo run mac +has_resources core.tar.xz mac +has_no_resources frameworks.tar.xz mac +cat manifest.json + +echo +echo "All good." + +echo "Build for Linux ..." + +cargo run linux +has_resources core.tar.xz linux +has_no_resources frameworks.tar.xz linux +cat manifest.json + +echo +echo "All good." + +echo "Building for Windows ..." + +cargo run windows +has_resources core.tar.xz windows +has_no_resources frameworks.tar.xz windows +cat manifest.json + +echo +echo "All good. Ship it."