From ea409bd888582a6696068c725f9ae22358fbbb6f Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Fri, 1 Dec 2023 10:01:31 +0100 Subject: [PATCH] first attempt making build steps easier --- .github/workflows/build_multiplatform.yml | 71 ++--------------------- .github/workflows/modem_tests.yml | 8 +-- gui/electron-builder.json5 | 4 +- gui/electron/main/index.ts | 18 +++--- 4 files changed, 17 insertions(+), 84 deletions(-) diff --git a/.github/workflows/build_multiplatform.yml b/.github/workflows/build_multiplatform.yml index 44e172c5..f7c6a50a 100644 --- a/.github/workflows/build_multiplatform.yml +++ b/.github/workflows/build_multiplatform.yml @@ -283,53 +283,10 @@ jobs: CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} - - name: Build binaries macOS - if: ${{startsWith(matrix.os, 'macos')}} - working-directory: modem - run: | - # now build modem binaries - pyinstaller -y freedata.spec - # and to some final cleanup - # cp -r -f dist/modem/* dist/ - # rm -r dist/modem - - name: Build binaries Linux and Windows - if: ${{!startsWith(matrix.os, 'macos')}} working-directory: modem run: | - # pyinstaller freedata.spec - # python3 -m nuitka --enable-plugin=numpy --assume-yes-for-downloads --onefile daemon.py -o ${{ matrix.daemon_binary_name }} - # python3 -m nuitka --enable-plugin=numpy --assume-yes-for-downloads --onefile main.py -o ${{ matrix.modem_binary_name }} - python3 -m nuitka --enable-plugin=numpy --assume-yes-for-downloads --standalone daemon.py - python3 -m nuitka --enable-plugin=numpy --assume-yes-for-downloads --standalone main.py - - - name: Copy binaries - Linux - if: ${{startsWith(matrix.os, 'ubuntu')}} - working-directory: modem - run: | - cp -r -f daemon.dist/* dist/modem - cp -r -f main.dist/* dist/modem - - - name: Copy binaries - Windows - if: ${{startsWith(matrix.os, 'windows')}} - working-directory: modem - # These are powershell aliases, not UNIX commands. - run: | - cp -r -Force daemon.dist/* dist/modem - cp -r -Force main.dist/* dist/modem - - - name: Rename modem binaries - # we don't need renaming for pyinstaller builds as output name is defined - if: ${{!startsWith(matrix.os, 'macos')}} - working-directory: modem - run: | - mv dist/modem/daemon* dist/modem/${{ matrix.daemon_binary_name }} - mv dist/modem/main* dist/modem/${{ matrix.modem_binary_name }} - - - uses: actions/download-artifact@v3 - with: - path: modem/dist/modem - + python3 -m nuitka --enable-plugin=numpy --remove-output --assume-yes-for-downloads --standalone server.py - name: LIST ALL FILES run: ls -R @@ -338,7 +295,7 @@ jobs: if: ${{!startsWith(matrix.os, 'windows')}} working-directory: modem run: | - if ! test -d "dist/modem/_sounddevice_data"; then + if ! test -d "server.dist/modem/_sounddevice_data"; then git clone https://github.com/spatialaudio/portaudio-binaries dist/modem/_sounddevice_data/portaudio-binaries fi @@ -346,7 +303,7 @@ jobs: if: ${{startsWith(matrix.os, 'windows')}} working-directory: modem run: | - if(Test-Path -Path "dist/modem/_sounddevice_data"){ + if(Test-Path -Path "server.dist/modem/_sounddevice_data"){ echo "sounddevice folder already exists" } else { git clone https://github.com/spatialaudio/portaudio-binaries dist/modem/_sounddevice_data/portaudio-binaries @@ -379,8 +336,7 @@ jobs: with: type: 'zip' filename: '${{ matrix.zip_name }}.zip' - # directory: ./modem/dist/modem - directory: ./modem/dist/modem + directory: ./modem/server.dist path: . # exclusions: '*.git* /*node_modules/* .editorconfig' @@ -389,24 +345,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: draft: true - files: ./modem/dist/modem/${{ matrix.zip_name }}.zip - #files: ./modem/dist/${{ matrix.zip_name }}.zip + files: ./modem/server.dist/${{ matrix.zip_name }}.zip - name: LIST ALL FILES run: ls -R - - #- name: Upload Modem artifacts - # uses: actions/upload-artifact@v3 - # if: ${{!startsWith(github.ref, 'refs/tags/v')}} - # with: - # name: ${{ matrix.zip_name }}.zip - # # path: ./modem/dist/modem/${{ matrix.zip_name }}.zip - # path: ./modem/dist/modem/${{ matrix.zip_name }}.zip# - - #- name: Upload App bundle artifacts - # uses: actions/upload-artifact@v3 - # if: ${{!startsWith(github.ref, 'refs/tags/v')}} - # with: - # name: app_bundle_${{ matrix.os }}.zip - # # path: ./modem/dist/modem/${{ matrix.zip_name }}.zip - # path: ./gui/dist/* diff --git a/.github/workflows/modem_tests.yml b/.github/workflows/modem_tests.yml index db75cb22..d613cb8e 100644 --- a/.github/workflows/modem_tests.yml +++ b/.github/workflows/modem_tests.yml @@ -53,11 +53,5 @@ jobs: - name: run config tests shell: bash - working-directory: modem run: | - python3 tests/test_config.py - - - name: run server tests - shell: bash - run: | - python3 tests/test_server.py \ No newline at end of file + python -m unittest discover tests \ No newline at end of file diff --git a/gui/electron-builder.json5 b/gui/electron-builder.json5 index 2a93a984..5bcf15e6 100644 --- a/gui/electron-builder.json5 +++ b/gui/electron-builder.json5 @@ -19,13 +19,13 @@ "files": [ "dist", "dist-electron", - "../modem/dist/modem/", + "../modem/server.dist/", ], "extraResources": [ { - "from": "../modem/dist/modem/", + "from": "../modem/server.dist/", "to": "modem", "filter": [ "**/*", diff --git a/gui/electron/main/index.ts b/gui/electron/main/index.ts index a3b24f57..c1536d13 100644 --- a/gui/electron/main/index.ts +++ b/gui/electron/main/index.ts @@ -105,15 +105,15 @@ console.log(platform()) var daemonPath = ""; switch (platform().toLowerCase()) { case "darwin": - daemonPath = join(process.resourcesPath, "modem", "freedata-daemon"); + daemonPath = join(process.resourcesPath, "modem", "freedata-server"); case "linux": - daemonPath = join(process.resourcesPath, "modem", "freedata-daemon"); + daemonPath = join(process.resourcesPath, "modem", "freedata-server"); break; case "win32": - daemonPath = join(process.resourcesPath, "modem", "freedata-daemon.exe"); + daemonPath = join(process.resourcesPath, "modem", "freedata-server.exe"); break; case "win64": - daemonPath = join(process.resourcesPath, "modem", "freedata-daemon.exe"); + daemonPath = join(process.resourcesPath, "modem", "freedata-server.exe"); break; default: console.log("Unhandled OS Platform: ", platform()); @@ -122,11 +122,11 @@ console.log(platform()) //Start daemon binary if it exists if (existsSync(daemonPath)) { - console.log("Starting freedata-daemon binary"); + console.log("Starting freedata-server binary"); console.log("daemonPath:", daemonPath); console.log("CWD:", join(daemonPath, "..")); /* - var daemonProcess = spawn("freedata-daemon", [], { + var daemonProcess = spawn("freedata-server", [], { cwd: join(process.env.DIST, "modem"), shell: true }); @@ -292,17 +292,17 @@ function close_sub_processes() { try { if (platform() == "win32") { spawn("Taskkill", ["/IM", "freedata-modem.exe", "/F"]); - spawn("Taskkill", ["/IM", "freedata-daemon.exe", "/F"]); + spawn("Taskkill", ["/IM", "freedata-server.exe", "/F"]); } if (platform() == "linux") { spawn("pkill", ["-9", "freedata-modem"]); - spawn("pkill", ["-9", "freedata-daemon"]); + spawn("pkill", ["-9", "freedata-server"]); } if (platform() == "darwin") { spawn("pkill", ["-9", "freedata-modem"]); - spawn("pkill", ["-9", "freedata-daemon"]); + spawn("pkill", ["-9", "freedata-server"]); } } catch (e) { console.log(e);