From e5fd830cf996c00641e1206d479e402b2ce3dc33 Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Wed, 3 Apr 2024 12:36:36 +0100 Subject: [PATCH] require successful tests before building the binary --- .github/workflows/build-branch.yml | 1 + scripts/build-binary.sh | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index e215b6bc..25fc2aee 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -48,6 +48,7 @@ jobs: # apt-get install python3-tk pip install --upgrade pip pip install -r requirements.txt + pip install coverage pip install pyinstaller - name: Build with pyinstaller diff --git a/scripts/build-binary.sh b/scripts/build-binary.sh index 5e495a96..00dcbbf2 100755 --- a/scripts/build-binary.sh +++ b/scripts/build-binary.sh @@ -1,8 +1,17 @@ #!/usr/bin/env bash script_dir="$(dirname "$0")" repo_root="$(dirname "$script_dir")" -if ! which pyinstaller >/dev/null 2>&1; then - echo "Error: Need to install pyinstaller; e.g. 'pip3 install pyinstaller'" +if ! python -c 'import coverage' >/dev/null 2>&1; then + echo "Error: Need to install coverage; e.g. 'pip install coverage'" exit 1 fi -python3 -m PyInstaller --clean "${repo_root}/LogosLinuxInstaller.spec" +if ! python -c 'import PyInstaller' >/dev/null 2>&1; then + echo "Error: Need to install pyinstaller; e.g. 'pip install pyinstaller'" + exit 1 +fi +if ! python -m coverage run -m unittest -b; then + echo "Error: Must past unittests before building" + echo "Run 'python -m coverage run -m unittest -b -v' to see which test is failing" + exit 1 +fi +python -m PyInstaller --clean "${repo_root}/LogosLinuxInstaller.spec"