first attempt making build steps easier

This commit is contained in:
DJ2LS 2023-12-01 10:01:31 +01:00
parent 02062e3e18
commit ea409bd888
4 changed files with 17 additions and 84 deletions

View file

@ -283,53 +283,10 @@ jobs:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} 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 - name: Build binaries Linux and Windows
if: ${{!startsWith(matrix.os, 'macos')}}
working-directory: modem working-directory: modem
run: | run: |
# pyinstaller freedata.spec python3 -m nuitka --enable-plugin=numpy --remove-output --assume-yes-for-downloads --standalone server.py
# 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
- name: LIST ALL FILES - name: LIST ALL FILES
run: ls -R run: ls -R
@ -338,7 +295,7 @@ jobs:
if: ${{!startsWith(matrix.os, 'windows')}} if: ${{!startsWith(matrix.os, 'windows')}}
working-directory: modem working-directory: modem
run: | 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 git clone https://github.com/spatialaudio/portaudio-binaries dist/modem/_sounddevice_data/portaudio-binaries
fi fi
@ -346,7 +303,7 @@ jobs:
if: ${{startsWith(matrix.os, 'windows')}} if: ${{startsWith(matrix.os, 'windows')}}
working-directory: modem working-directory: modem
run: | run: |
if(Test-Path -Path "dist/modem/_sounddevice_data"){ if(Test-Path -Path "server.dist/modem/_sounddevice_data"){
echo "sounddevice folder already exists" echo "sounddevice folder already exists"
} else { } else {
git clone https://github.com/spatialaudio/portaudio-binaries dist/modem/_sounddevice_data/portaudio-binaries git clone https://github.com/spatialaudio/portaudio-binaries dist/modem/_sounddevice_data/portaudio-binaries
@ -379,8 +336,7 @@ jobs:
with: with:
type: 'zip' type: 'zip'
filename: '${{ matrix.zip_name }}.zip' filename: '${{ matrix.zip_name }}.zip'
# directory: ./modem/dist/modem directory: ./modem/server.dist
directory: ./modem/dist/modem
path: . path: .
# exclusions: '*.git* /*node_modules/* .editorconfig' # exclusions: '*.git* /*node_modules/* .editorconfig'
@ -389,24 +345,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
with: with:
draft: true draft: true
files: ./modem/dist/modem/${{ matrix.zip_name }}.zip files: ./modem/server.dist/${{ matrix.zip_name }}.zip
#files: ./modem/dist/${{ matrix.zip_name }}.zip
- name: LIST ALL FILES - name: LIST ALL FILES
run: ls -R 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/*

View file

@ -53,11 +53,5 @@ jobs:
- name: run config tests - name: run config tests
shell: bash shell: bash
working-directory: modem
run: | run: |
python3 tests/test_config.py python -m unittest discover tests
- name: run server tests
shell: bash
run: |
python3 tests/test_server.py

View file

@ -19,13 +19,13 @@
"files": [ "files": [
"dist", "dist",
"dist-electron", "dist-electron",
"../modem/dist/modem/", "../modem/server.dist/",
], ],
"extraResources": [ "extraResources": [
{ {
"from": "../modem/dist/modem/", "from": "../modem/server.dist/",
"to": "modem", "to": "modem",
"filter": [ "filter": [
"**/*", "**/*",

View file

@ -105,15 +105,15 @@ console.log(platform())
var daemonPath = ""; var daemonPath = "";
switch (platform().toLowerCase()) { switch (platform().toLowerCase()) {
case "darwin": case "darwin":
daemonPath = join(process.resourcesPath, "modem", "freedata-daemon"); daemonPath = join(process.resourcesPath, "modem", "freedata-server");
case "linux": case "linux":
daemonPath = join(process.resourcesPath, "modem", "freedata-daemon"); daemonPath = join(process.resourcesPath, "modem", "freedata-server");
break; break;
case "win32": case "win32":
daemonPath = join(process.resourcesPath, "modem", "freedata-daemon.exe"); daemonPath = join(process.resourcesPath, "modem", "freedata-server.exe");
break; break;
case "win64": case "win64":
daemonPath = join(process.resourcesPath, "modem", "freedata-daemon.exe"); daemonPath = join(process.resourcesPath, "modem", "freedata-server.exe");
break; break;
default: default:
console.log("Unhandled OS Platform: ", platform()); console.log("Unhandled OS Platform: ", platform());
@ -122,11 +122,11 @@ console.log(platform())
//Start daemon binary if it exists //Start daemon binary if it exists
if (existsSync(daemonPath)) { if (existsSync(daemonPath)) {
console.log("Starting freedata-daemon binary"); console.log("Starting freedata-server binary");
console.log("daemonPath:", daemonPath); console.log("daemonPath:", daemonPath);
console.log("CWD:", join(daemonPath, "..")); console.log("CWD:", join(daemonPath, ".."));
/* /*
var daemonProcess = spawn("freedata-daemon", [], { var daemonProcess = spawn("freedata-server", [], {
cwd: join(process.env.DIST, "modem"), cwd: join(process.env.DIST, "modem"),
shell: true shell: true
}); });
@ -292,17 +292,17 @@ function close_sub_processes() {
try { try {
if (platform() == "win32") { if (platform() == "win32") {
spawn("Taskkill", ["/IM", "freedata-modem.exe", "/F"]); spawn("Taskkill", ["/IM", "freedata-modem.exe", "/F"]);
spawn("Taskkill", ["/IM", "freedata-daemon.exe", "/F"]); spawn("Taskkill", ["/IM", "freedata-server.exe", "/F"]);
} }
if (platform() == "linux") { if (platform() == "linux") {
spawn("pkill", ["-9", "freedata-modem"]); spawn("pkill", ["-9", "freedata-modem"]);
spawn("pkill", ["-9", "freedata-daemon"]); spawn("pkill", ["-9", "freedata-server"]);
} }
if (platform() == "darwin") { if (platform() == "darwin") {
spawn("pkill", ["-9", "freedata-modem"]); spawn("pkill", ["-9", "freedata-modem"]);
spawn("pkill", ["-9", "freedata-daemon"]); spawn("pkill", ["-9", "freedata-server"]);
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);