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_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/*

View file

@ -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
python -m unittest discover tests

View file

@ -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": [
"**/*",

View file

@ -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);