From 38e2200b83f9f4697fff731adf71ed78d163ec2a Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 11 Mar 2023 11:23:27 -0800 Subject: [PATCH 01/11] now building on 22.04 20.04 and windows --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 893d150..57c92d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,10 @@ on: jobs: # This workflow contains a single job called "build" build_linux: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-20.04] steps: - uses: actions/checkout@v3 From 7155cb6721dff40d3ec18f227afcd634c4cdec09 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 11 Mar 2023 11:44:43 -0800 Subject: [PATCH 02/11] updated build script --- .github/workflows/build.yml | 27 +++++++++++++++++++++++++-- generate_executable.py | 14 +++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57c92d8..46a117f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,8 +24,8 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: iq_sim_client_linux - path: iq_sim_client_linux.zip + name: format( 'iq_sim_client_linux_{0}', matrix.os ) + path: iq_sim_client_linux*.zip if-no-files-found: error build_windows: @@ -45,3 +45,26 @@ jobs: name: iq_sim_client_windows path: iq_sim_client_windows.zip if-no-files-found: error + + # - name: Create release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ github.event.inputs.version }} + # release_name: Release ${{ github.event.inputs.version }} + # body: | + # Release ${{ github.event.inputs.version }} + # draft: false + # prerelease: false + # id: release + + # - name: Upload release asset + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.release.outputs.upload_url }} + # asset_path: ${{ steps.build.outputs.artifact_path }} + # asset_name: some-file-name.ext + # asset_content_type: application/octet-stream \ No newline at end of file diff --git a/generate_executable.py b/generate_executable.py index 6511ddb..f6122a4 100644 --- a/generate_executable.py +++ b/generate_executable.py @@ -1,7 +1,8 @@ import os import shutil -from sys import platform - +import sys +import platform +import distro def main(): try: @@ -14,14 +15,17 @@ def main(): except: print("no file iq_sim_client.zip") - if platform == "linux" or platform == "linux2": + if sys.platform == "linux" or sys.platform == "linux2": shutil.copytree("mavp2p/mavp2p_linux", "iq_sim_client/mavp2p/mavp2p_linux") output_filename = "iq_sim_client_linux" - elif platform == "darwin": + distro_name = distro.name(pretty=True).replace(" ", "_").replace(".", "_") + print(distro_name) + output_filename = output_filename + "_" + distro_name + elif sys.platform == "darwin": print("todo") return - elif platform == "win32": + elif sys.platform == "win32": shutil.copytree("mavp2p/mavp2p_windows", "iq_sim_client/mavp2p/mavp2p_windows") output_filename = "iq_sim_client_windows" From bf8fe72b16a06f9e151b519084509e197bfd2e7f Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 11 Mar 2023 11:48:57 -0800 Subject: [PATCH 03/11] updated requirements --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 028810e..0506188 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -PyQt5==5.15.7 -requests==2.22.0 +distro==1.8.0 +PyQt5==5.15.9 +requests==2.28.1 pyinstaller==5.3 \ No newline at end of file From 7b880d06c529473fedb531b306a374797248130c Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 11 Mar 2023 11:57:21 -0800 Subject: [PATCH 04/11] updated python setup --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46a117f..0965a4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,10 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 'pypy3.8' + - name: Install Pip Packages run: pip install -r requirements.txt @@ -24,7 +28,7 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: format( 'iq_sim_client_linux_{0}', matrix.os ) + name: iq_sim_client_linux_${{ matrix.os }} path: iq_sim_client_linux*.zip if-no-files-found: error From 97d1c6d4e166e2d3b3a8c85e37bc445ca9c285c4 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 11 Mar 2023 12:02:16 -0800 Subject: [PATCH 05/11] fixing requirement version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0506188..f231ac3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ distro==1.8.0 -PyQt5==5.15.9 +PyQt5==5.15.7 requests==2.28.1 pyinstaller==5.3 \ No newline at end of file From e36061ff683ba65d1efaaba81a8df72e244448e6 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 11 Mar 2023 12:05:10 -0800 Subject: [PATCH 06/11] resetting build file --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0965a4f..19d8c81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,10 +16,6 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: 'pypy3.8' - - name: Install Pip Packages run: pip install -r requirements.txt From e40cd229f61dda7e2d7ab01048c47ee628f6234f Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 11 Mar 2023 14:37:50 -0600 Subject: [PATCH 07/11] forcing app to use wayland --- app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app.py b/app.py index ef1bb93..90311f9 100644 --- a/app.py +++ b/app.py @@ -7,6 +7,8 @@ import os from sys import platform +os.environ['QT_QPA_PLATFORM'] = "wayland" + class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): mavp2p_process = None From 0756e009008773e73c437b16d4b20fac47877e05 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 11 Mar 2023 14:48:07 -0600 Subject: [PATCH 08/11] updated matrix build --- .github/workflows/build.yml | 24 +++--------------------- app.py | 8 +++++++- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19d8c81..3a6cb79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, ubuntu-20.04] + os: [ubuntu-22.04, ubuntu-20.04, windows-latest] steps: - uses: actions/checkout@v3 @@ -24,26 +24,8 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: iq_sim_client_linux_${{ matrix.os }} - path: iq_sim_client_linux*.zip - if-no-files-found: error - - build_windows: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - - name: Install Pip Packages - run: pip install -r requirements.txt - - - name: Run a Python script - run: python generate_executable.py - - - uses: actions/upload-artifact@v3 - with: - name: iq_sim_client_windows - path: iq_sim_client_windows.zip + name: iq_sim_client_${{ matrix.os }} + path: iq_sim_client_*.zip if-no-files-found: error # - name: Create release diff --git a/app.py b/app.py index 90311f9..dfba771 100644 --- a/app.py +++ b/app.py @@ -5,9 +5,15 @@ import requests import subprocess import os +import distro from sys import platform -os.environ['QT_QPA_PLATFORM'] = "wayland" + +# check if distro is ubuntu 22.04 +# distro = distro.name(pretty=True).replace(" ", "_").replace(".", "_") +# if distro == "Ubuntu_22.04": +# print("setting qt platform to wayland") +# os.environ['QT_QPA_PLATFORM'] = "wayland" class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): From b16025794f6aa01a999ff7e2a1df42cdbb1fba98 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 11 Mar 2023 15:32:33 -0600 Subject: [PATCH 09/11] added check to set qt_qpa_platform to wayland on 20.04 --- .github/workflows/build.yml | 2 +- app.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a6cb79..1d055e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" - build_linux: + build: runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/app.py b/app.py index dfba771..8a261bc 100644 --- a/app.py +++ b/app.py @@ -10,10 +10,11 @@ # check if distro is ubuntu 22.04 -# distro = distro.name(pretty=True).replace(" ", "_").replace(".", "_") -# if distro == "Ubuntu_22.04": -# print("setting qt platform to wayland") -# os.environ['QT_QPA_PLATFORM'] = "wayland" +distro = distro.name(pretty=True).replace(" ", "_").replace(".", "_") +print(distro) +if "22_04" in distro: + print("setting qt platform to wayland") + os.environ['QT_QPA_PLATFORM'] = "wayland" class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): From 8d9148b92a21a99168effc830e476ee2e7170a27 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 11 Mar 2023 15:41:31 -0600 Subject: [PATCH 10/11] updating so that workflow only produces one zip --- .github/workflows/build.yml | 2 +- generate_executable.py | 19 +++++++++++++++---- requirements.txt | 3 ++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d055e5..d0644b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/upload-artifact@v3 with: name: iq_sim_client_${{ matrix.os }} - path: iq_sim_client_*.zip + path: iq_sim_client if-no-files-found: error # - name: Create release diff --git a/generate_executable.py b/generate_executable.py index f6122a4..ad510e9 100644 --- a/generate_executable.py +++ b/generate_executable.py @@ -3,8 +3,9 @@ import sys import platform import distro +import argparse -def main(): +def main(zip): try: shutil.rmtree("iq_sim_client") except: @@ -31,10 +32,20 @@ def main(): output_filename = "iq_sim_client_windows" os.system("pyinstaller -F app.py --distpath iq_sim_client") - shutil.copytree("imgs", "iq_sim_client/imgs") - shutil.make_archive(output_filename, 'zip', "iq_sim_client") + if zip: + print("zipping application") + shutil.make_archive(output_filename, 'zip', "iq_sim_client") + else: + print("not zipping application") if __name__ == "__main__": - main() + # parse arguments + parser = argparse.ArgumentParser() + parser.add_argument("--zip", help="zip the executable", action="store_true") + + args = parser.parse_args() + + + main(args.zip) diff --git a/requirements.txt b/requirements.txt index f231ac3..a620e76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ distro==1.8.0 PyQt5==5.15.7 requests==2.28.1 -pyinstaller==5.3 \ No newline at end of file +pyinstaller==5.3 +argparse==1.4.0 \ No newline at end of file From 71c2ddc61b00d91f511759368c83146ca4c80a5f Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 11 Mar 2023 16:05:12 -0600 Subject: [PATCH 11/11] clean up --- .github/workflows/build.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0644b6..34bcbff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,26 +27,3 @@ jobs: name: iq_sim_client_${{ matrix.os }} path: iq_sim_client if-no-files-found: error - - # - name: Create release - # uses: actions/create-release@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: ${{ github.event.inputs.version }} - # release_name: Release ${{ github.event.inputs.version }} - # body: | - # Release ${{ github.event.inputs.version }} - # draft: false - # prerelease: false - # id: release - - # - name: Upload release asset - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ steps.release.outputs.upload_url }} - # asset_path: ${{ steps.build.outputs.artifact_path }} - # asset_name: some-file-name.ext - # asset_content_type: application/octet-stream \ No newline at end of file