From c1d90bf0c202f27becb2d3285e6f7a470693ec10 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Tue, 6 Jun 2023 09:31:53 +0100 Subject: [PATCH] Add DEB bundle (#483) --- .github/workflows/ci.yml | 57 +++++++++++++++++------------ Makefile | 4 +- assets/buzz.svg | 38 +++++++++++++++++++ assets/buzz.desktop => buzz.desktop | 13 ++++++- scripts/bundle_linux.sh | 24 ++++++++++++ 5 files changed, 108 insertions(+), 28 deletions(-) create mode 100644 assets/buzz.svg rename assets/buzz.desktop => buzz.desktop (71%) create mode 100644 scripts/bundle_linux.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dd62ba9..a849b6e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,15 +63,14 @@ jobs: - name: Install dependencies run: poetry install + - name: Install apt dependencies + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends libyaml-dev libegl1-mesa libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-shape0 libxcb-cursor0 libportaudio2 gettext + if: "startsWith(matrix.os, 'ubuntu-')" + - name: Test run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX - sudo apt update - sudo apt install -y libpulse-mainloop-glib0 libegl1-mesa-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libportaudio2 - fi - if [ "$RUNNER_OS" == "Windows" ]; then curl -OL "https://github.com/ggerganov/whisper.cpp/releases/download/v1.3.0/whisper-bin-x64.zip" unzip whisper-bin-x64.zip @@ -124,6 +123,22 @@ jobs: - name: Install dependencies run: poetry install + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' # Not needed with a .ruby-version file + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + if: "startsWith(matrix.os, 'ubuntu-')" + + - name: Install apt dependencies + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends libyaml-dev libegl1-mesa libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-shape0 libxcb-cursor0 libportaudio2 gettext + if: "startsWith(matrix.os, 'ubuntu-')" + + - name: Install FPM + run: gem install fpm + if: "startsWith(matrix.os, 'ubuntu-')" + - name: Bundle run: | if [ "$RUNNER_OS" == "macOS" ]; then @@ -160,13 +175,9 @@ jobs: poetry run make bundle_windows elif [ "$RUNNER_OS" == "Linux" ]; then - - sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX - sudo apt update - sudo apt install -y libpulse-mainloop-glib0 libegl1-mesa-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libportaudio2 gettext + poetry run make bundle_linux - + fi env: BUZZ_CODESIGN_IDENTITY: ${{ secrets.BUZZ_CODESIGN_IDENTITY }} @@ -185,7 +196,7 @@ jobs: path: | dist/Buzz*-windows.exe dist/Buzz*-mac.dmg - dist/Buzz*-unix.tar.gz + dist/buzz-*.deb benchmark: runs-on: ${{ matrix.os }} @@ -238,15 +249,14 @@ jobs: - name: Install dependencies run: poetry install + - name: Install apt dependencies + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends libyaml-dev libegl1-mesa libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-shape0 libxcb-cursor0 libportaudio2 gettext + if: "startsWith(matrix.os, 'ubuntu-')" + - name: Test run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX - sudo apt update - sudo apt install -y libpulse-mainloop-glib0 libegl1-mesa-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libportaudio2 - fi - poetry run make benchmarks shell: bash @@ -270,7 +280,7 @@ jobs: - os: macos-latest - os: windows-latest - os: ubuntu-20.04 - needs: [build, test] + needs: [ build, test ] if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v3 @@ -288,13 +298,14 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | + buzz-*.deb Buzz*-unix.tar.gz Buzz*-windows.exe Buzz*-mac.dmg deploy_brew_cask: runs-on: macos-latest - needs: [release] + needs: [ release ] if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v3 diff --git a/Makefile b/Makefile index d8cd7245..acbbd293 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,8 @@ mac_app_path := ./dist/Buzz.app mac_zip_path := ./dist/Buzz-${version}-mac.zip mac_dmg_path := ./dist/Buzz-${version}-mac.dmg -unix_zip_path := Buzz-${version}-unix.tar.gz - bundle_linux: dist/Buzz - cd dist && tar -czf ${unix_zip_path} Buzz/ && cd - + bash scripts/bundle_linux.sh bundle_windows: dist/Buzz iscc //DAppVersion=${version} installer.iss diff --git a/assets/buzz.svg b/assets/buzz.svg new file mode 100644 index 00000000..ce85e422 --- /dev/null +++ b/assets/buzz.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/buzz.desktop b/buzz.desktop similarity index 71% rename from assets/buzz.desktop rename to buzz.desktop index c3defed0..d62a1ec6 100644 --- a/assets/buzz.desktop +++ b/buzz.desktop @@ -1,8 +1,17 @@ [Desktop Entry] + Type=Application + Encoding=UTF-8 + Name=Buzz -Comment=Buzz transcribes and translates audio offline on your personal computer -Exec=buzz + +Comment=Buzz transcribes and translates audio offline on your personal computer. + +Path=/opt/buzz + +Exec=/opt/buzz/Buzz + Icon=buzz + Terminal=False diff --git a/scripts/bundle_linux.sh b/scripts/bundle_linux.sh new file mode 100644 index 00000000..6158a3bf --- /dev/null +++ b/scripts/bundle_linux.sh @@ -0,0 +1,24 @@ +# https://www.pythonguis.com/tutorials/packaging-pyqt5-applications-linux-pyinstaller/ + +PYINSTALLER_BUILD_PATH="dist/Buzz" +PACKAGE_PATH="dist/package" +VERSION=$(poetry version -s) +DEB_PATH="dist/buzz-$VERSION.deb" + +mkdir -p $PACKAGE_PATH/opt +mkdir -p $PACKAGE_PATH/usr/share/applications +mkdir -p $PACKAGE_PATH/usr/share/icons/hicolor/scalable/apps + +cp -r $PYINSTALLER_BUILD_PATH $PACKAGE_PATH/opt/buzz +cp buzz.desktop $PACKAGE_PATH/usr/share/applications + +# Copy icons +cp assets/buzz.svg $PACKAGE_PATH/usr/share/icons/hicolor/scalable/apps/buzz.svg + +# Set permissions +find $PACKAGE_PATH/opt/buzz -type f -exec chmod 644 -- {} + +find $PACKAGE_PATH/opt/buzz -type d -exec chmod 755 -- {} + +find $PACKAGE_PATH/usr/share -type f -exec chmod 644 -- {} + +chmod +x $PACKAGE_PATH/opt/buzz/Buzz + +fpm -C $PACKAGE_PATH -s dir -t deb -n "buzz" -v $VERSION -p $DEB_PATH