From 1fc19f6ba3599708649d9dc4b0b5ca5064d4ae6d Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Tue, 1 Oct 2024 21:50:10 +0200 Subject: [PATCH] Adding rebuild to scripts --- ci/drone.yml | 4 ++-- run.py | 2 +- scripts/build-macosx.sh | 23 ++++++++++++++++++++--- scripts/build-wine.sh | 21 +++++++++++++++++++-- scripts/package-deb.sh | 21 +++++++++++++++++++-- scripts/package-macosx.sh | 8 ++++---- scripts/run-tests.sh | 26 ++++++++++++++++++++++---- 7 files changed, 87 insertions(+), 18 deletions(-) diff --git a/ci/drone.yml b/ci/drone.yml index b04d9df..da7d1c7 100644 --- a/ci/drone.yml +++ b/ci/drone.yml @@ -28,7 +28,7 @@ steps: - apt update - apt install -y npm - cd common && npm install -D && cd .. - - xvfb-run bash scripts/run-tests.sh + - xvfb-run bash scripts/run-tests.sh --no-rebuild when: event: [ push, tag ] @@ -44,7 +44,7 @@ steps: - name: Windows build image: ad5001/ubuntu-pyside-xvfb:wine-6-latest commands: - - bash scripts/build-wine.sh + - bash scripts/build-wine.sh --no-rebuild - bash scripts/package-wine.sh when: event: [ push, tag ] diff --git a/run.py b/run.py index 0c2bda7..783e23b 100644 --- a/run.py +++ b/run.py @@ -32,7 +32,7 @@ if __name__ == "__main__": if '--test-build' not in argv: build() logplotter_path = path.realpath(path.join(getcwd(), "build", "runtime-pyside6")) - print("Appending " + logplotter_path + " to path...") + print(f"Appending {logplotter_path} to path...") sys_path.append(logplotter_path) run() diff --git a/scripts/build-macosx.sh b/scripts/build-macosx.sh index c76b5ec..2ccd626 100755 --- a/scripts/build-macosx.sh +++ b/scripts/build-macosx.sh @@ -2,8 +2,25 @@ DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$DIR/.." || exit 1 -rm -rf build -bash scripts/build.sh +rebuild=true + +while [ $# -gt 0 ]; do + case "$1" in + --no-rebuild) + rebuild=false + ;; + *) + box "Error: Invalid argument." + exit 1 + esac + shift +done + +if [ "$rebuild" == "true" ]; then + rm -rf build + bash scripts/build.sh +fi + cd build/runtime-pyside6 || exit 1 rm $(find . -name "*.pyc") @@ -30,7 +47,7 @@ cp ../../assets/native/mac/Info.plist dist/LogarithmPlotter.app/Contents/Info.pl # Remove QtWebEngine, 3D and all other unused libs libs rm -rf dist/LogarithmPlotter.app/Contents/MacOS/{QtWeb*,*3D*,QtRemote*,QtPdf,QtCharts,QtLocation,QtTest,QtMultimedia,QtSpatialAudio,QtDataVisualization,QtQuickParticles,QtChartsQml,QtScxml,QtDataVisualizationQml,QtTest,QtPositioningQuick,QtQuickTest,QtSql,QtSensorsQuick} -rm -rf dist/LogarithmPlotter.app/Contents/MacOS/PySide6/{QtNetwork.abi3.so} +rm -rf dist/LogarithmPlotter.app/Contents/MacOS/PySide6/QtNetwork.abi3.so # Removing QtQuick3D rm -rf dist/LogarithmPlotter.app/Contents/MacOS/PySide6/Qt/qml/{QtQuick3D,Qt3D,QtWebEngine} diff --git a/scripts/build-wine.sh b/scripts/build-wine.sh index 1b4e9cb..fa78bb1 100644 --- a/scripts/build-wine.sh +++ b/scripts/build-wine.sh @@ -1,8 +1,25 @@ #!/bin/bash cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.." || exit -rm -rf build -bash scripts/build.sh +rebuild=true + +while [ $# -gt 0 ]; do + case "$1" in + --no-rebuild) + rebuild=false + ;; + *) + box "Error: Invalid argument." + exit 1 + esac + shift +done + +if [ "$rebuild" == "true" ]; then + rm -rf build + bash scripts/build.sh +fi + cd build/runtime-pyside6 || exit 1 rm -rf $(find . -name "*.pyc") diff --git a/scripts/package-deb.sh b/scripts/package-deb.sh index b280675..8ed03ee 100755 --- a/scripts/package-deb.sh +++ b/scripts/package-deb.sh @@ -1,8 +1,25 @@ #!/bin/bash cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.." || exit 1 -rm -rf build -bash scripts/build.sh +rebuild=true + +while [ $# -gt 0 ]; do + case "$1" in + --no-rebuild) + rebuild=false + ;; + *) + box "Error: Invalid argument." + exit 1 + esac + shift +done + +if [ "$rebuild" == "true" ]; then + rm -rf build + bash scripts/build.sh +fi + cd build/runtime-pyside6 || exit 1 mkdir assets diff --git a/scripts/package-macosx.sh b/scripts/package-macosx.sh index d38ecdc..c050a32 100644 --- a/scripts/package-macosx.sh +++ b/scripts/package-macosx.sh @@ -18,7 +18,7 @@ cp ../../../README.md Installer/README.md # Calculating folder size duoutput=$(du -h Installer | tail -n1) -size=$(expr ${duoutput%M*} + 2) # +2 for allowing small space to edit. +size=$(( ${duoutput%M*} + 2)) # +2 for allowing small space to edit. echo "Creating DMG file with size ${size}M." # Adapted from https://stackoverflow.com/a/1513578 @@ -26,7 +26,7 @@ hdiutil create -srcfolder "${source}" -volname "${title}" -fs HFS+ \ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}M pack.temp.dmg device=$(hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | \ - egrep '^/dev/' | sed 1q | awk '{print $1}') + grep -E '^/dev/' | sed 1q | awk '{print $1}') sleep 3 @@ -53,10 +53,10 @@ echo ' end tell end tell ' | osascript -chmod -Rf go-w /Volumes/"${title}" +chmod -Rf go-w "/Volumes/${title}" sync sync -hdiutil detach ${device} +hdiutil detach "${device}" hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o "${finalDMGName}" rm -f pack.temp.dmg rm -rf Installer diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 21b1f41..1410244 100644 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -1,8 +1,26 @@ #!/bin/bash -cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.." +cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.." || exit 1 + +rebuild=true + +while [ $# -gt 0 ]; do + case "$1" in + --no-rebuild) + rebuild=false + ;; + *) + box "Error: Invalid argument." + exit 1 + esac + shift +done + +if [ "$rebuild" == "true" ]; then + rm -rf build + bash scripts/build.sh +fi + -rm -rf build -bash scripts/build.sh # Run python tests cp -r runtime-pyside6/tests build/runtime-pyside6 @@ -12,6 +30,6 @@ PYTHONPATH="$PYTHONPATH:." pytest --cov=LogarithmPlotter --cov-report term-missi cd ../../ # Run js tests -cd common +cd common || exit 1 npm test