From e5109a604f9acf0dd872e14b48f1bfbfae2cb512 Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Fri, 3 May 2024 03:37:56 +0100 Subject: [PATCH 01/10] [API] Handle imink API being down --- client/api/__init__.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/api/__init__.py b/client/api/__init__.py index dd036da..f584c80 100644 --- a/client/api/__init__.py +++ b/client/api/__init__.py @@ -283,10 +283,20 @@ def __init__(self, userInfo, userLang, accessToken, guid): self.na_id = userInfo['id'] self.imink = imink(self.na_id, self.accessToken, self.timestamp, self.guid, 1).get() - self.timestamp = int(self.imink['timestamp']) - self.guid = self.imink['request_id'] - self.account = None + if 'error' in self.imink or self.imink.get('error') is not None: + iminkApiError = ( + 'Unable to authenticate with imink. \n\n' + 'The F Calculation API may be experiencing issues. \n' + 'Please check the website for more details: \n' + 'https://status.imink.app/ \n' + ) + raise RuntimeError(iminkApiError) from None + else: + self.timestamp = int(self.imink['timestamp']) + self.guid = self.imink['request_id'] + + self.account = None def loginToAccount(self): route = '/v3/Account/Login' From 4a14b101efd4ef10b09372538f7f10c1ec32f8b9 Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Wed, 8 May 2024 19:08:36 +0100 Subject: [PATCH 02/10] [API] Fix getVersion discrepency causing an error --- client/api/__init__.py | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/client/api/__init__.py b/client/api/__init__.py index f584c80..5a85f75 100644 --- a/client/api/__init__.py +++ b/client/api/__init__.py @@ -14,6 +14,33 @@ import pickle +def getVersionRegex(html: str): + try: + # Attempt to determine the appropriate regex pattern with prefix + version_with_prefix = re.compile(r'Version\s*\s*(\d+\.\d+\.\d+)').search(html) + if version_with_prefix: + return version_with_prefix + except Exception as e: + print(f"Failed to determine regex pattern with prefix: {e}") + + try: + # Attempt to determine an alternative regex pattern with prefix + version_without_space = re.compile(r'Version\s*(\d+\.\d+\.\d+)').search(html) + if version_without_space: + return version_without_space + except Exception as e: + print(f"Failed to determine alternative regex pattern with prefix: {e}") + + try: + # Attempt to determine an alternative regex pattern without prefix + version_no_prefix = re.compile(r'(\d+\.\d+\.\d+)').search(html) + if version_no_prefix: + return version_no_prefix + except Exception as e: + print(f"Failed to determine regex pattern without prefix: {e}") + return None + + def getAppPath(): # Check for macOS platform and NSO-RPC freeze status if sys.platform.startswith('darwin') and hasattr(sys, 'frozen') and sys.frozen == 'macosx_app': @@ -70,10 +97,10 @@ def getVersion(): else: log('Failed to get Apple\'s store page after multiple retries.') if r: - searchPattern = re.compile(r'Version\s*(\d\.\d\.\d)+') - version = searchPattern.search(r.text) + version = getVersionRegex(r.text) if version: - return version.group(1) + app_version = version.group(1) + return app_version return '' @@ -97,11 +124,11 @@ def getVersion(): class API(): def __init__(self, session_token, user_lang, targetID, version): - pattern = re.compile(r'(\d.\d.\d)') - if not version or not re.search(pattern, version): + version_match = getVersionRegex(version) + if not version_match: raise Exception('missing app version') global nsoAppVersion - nsoAppVersion = version + nsoAppVersion = version_match.group(1) self.headers = { 'X-ProductVersion': nsoAppVersion, 'X-Platform': 'iOS', @@ -287,7 +314,8 @@ def __init__(self, userInfo, userLang, accessToken, guid): if 'error' in self.imink or self.imink.get('error') is not None: iminkApiError = ( 'Unable to authenticate with imink. \n\n' - 'The F Calculation API may be experiencing issues. \n' + 'The F Calculation API may be experiencing issues or this build of NSO-RPC is outdated \n' + 'Please try the most upto date build of NSO-RPC before submitting an issue. \n' 'Please check the website for more details: \n' 'https://status.imink.app/ \n' ) From 9415c361d1075ceb3c0bce2dfc99c8e0740e0a96 Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Mon, 29 Apr 2024 22:09:37 +0100 Subject: [PATCH 03/10] [Github] Update actions and cleanup job ordering --- .github/workflows/actions.yml | 95 +++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 39 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index ddcb46e..1195cad 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -4,55 +4,71 @@ on: types: [published] jobs: - build-x86_64: - name: 'Build NSO-RPC - x86_64' - runs-on: ${{ matrix.os }} + build-windows: + name: 'Build NSO-RPC - Windows' + runs-on: windows-latest strategy: fail-fast: false matrix: - os: ['windows-latest', 'ubuntu-latest', 'macos-latest'] + pyqt_version: + - 'pyqt6' + - 'pyqt5' steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: 3.11.4 - - # Windows Build - name: "Build" - if: matrix.os == 'windows-latest' run: | + python -m pip install ${{ matrix.pyqt_version }} && cd scripts && - python -m pip install pyqt6 && ./build.bat - + - name: "Rename executable" + if: matrix.pyqt_version == 'pyqt5' + run: mv client/dist/NSO-RPC.exe client/dist/NSO-RPC-qt5.exe - name: "Upload Build" - if: matrix.os == 'windows-latest' - uses: softprops/action-gh-release@v0.1.15 + uses: softprops/action-gh-release@v2.0.4 with: - files: client/dist/NSO-RPC.exe + files: | + client/dist/NSO-RPC*.exe - # Linux Build + build-linux: + name: 'Build NSO-RPC - Linux' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11.4 - name: "Upload script" - if: matrix.os == 'ubuntu-latest' - uses: softprops/action-gh-release@v0.1.15 + run: | + cd scripts && + chmod +x linux.sh + continue-on-error: false + - name: "Upload Build" + uses: softprops/action-gh-release@v2.0.4 with: files: scripts/linux.sh - # MacOS Build + build-macos: + name: 'Build NSO-RPC - MacOS' + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11.4 - name: "Build" - if: matrix.os == 'macos-latest' run: | cd scripts && python -m pip install pyqt6 && - bash ./build.sh && + ./build.sh && cd ../client/dist && ln -s /Applications "Applications (admin)" && hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg && zip -yr mac-portable.zip NSO-RPC.app/ - - name: "Upload Build" - if: matrix.os == 'macos-latest' - uses: softprops/action-gh-release@v0.1.15 + uses: softprops/action-gh-release@v2.0.4 with: files: | client/dist/mac-installer.dmg @@ -62,9 +78,10 @@ jobs: name: 'Build NSO-RPC - Universal2' runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - # MacOS Universal Build + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11.4 - name: "Install Python 3.11.4 and build NSO-RPC" run: | curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg @@ -76,24 +93,24 @@ jobs: ln -s /Applications "Applications (admin)" && hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg && zip -yr mac-universal2-portable.zip NSO-RPC.app/ - - name: "Upload NSO-RPC Universal2 Build" - uses: softprops/action-gh-release@v0.1.15 + uses: softprops/action-gh-release@v2.0.4 with: files: | client/dist/mac-universal2-installer.dmg client/dist/mac-universal2-portable.zip get-hashes: - runs-on: "ubuntu-latest" - needs: ["build-x86_64", "build-universal2"] + name: 'Generate Checksums' + runs-on: ubuntu-latest + needs: [build-windows, build-linux, build-macos, build-universal2] steps: - - name: "Generate checksums.txt" - uses: MCJack123/ghaction-generate-release-hashes@v4 - with: - hash-type: sha256 - file-name: checksums.txt - get-assets: true - - uses: softprops/action-gh-release@v0.1.15 - with: - files: checksums.txt + - name: "Generate checksums.txt" + uses: MCJack123/ghaction-generate-release-hashes@v4 + with: + hash-type: sha256 + file-name: checksums.txt + get-assets: true + - uses: softprops/action-gh-release@v2.0.4 + with: + files: checksums.txt From 301efae5e8e22652838431ea8cc4589d66ce87fa Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Wed, 8 May 2024 19:56:41 +0100 Subject: [PATCH 04/10] [Github:MacOS] Use venv for macos building. Co-Authored-By: Spotlight --- scripts/build.sh | 3 +++ scripts/macos-universal2/build.sh | 2 ++ 2 files changed, 5 insertions(+) diff --git a/scripts/build.sh b/scripts/build.sh index 9eb8173..78c3161 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,3 +1,6 @@ +#!/bin/bash +python3 -m venv --upgrade-deps venv +source venv/bin/activate cd ../client python3 -m pip install -r requirements.txt py2app GitPython python3 _version.py diff --git a/scripts/macos-universal2/build.sh b/scripts/macos-universal2/build.sh index c523351..2e35579 100755 --- a/scripts/macos-universal2/build.sh +++ b/scripts/macos-universal2/build.sh @@ -1,4 +1,6 @@ #!/bin/bash +python3 -m venv --upgrade-deps venv +source venv/bin/activate python3 -m pip install wheel PyQt6 bash prep-PyQt.sh cd ../../client From ea53acb9134f73e8304869e51e3658243da1ecae Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Tue, 14 May 2024 00:47:03 +0100 Subject: [PATCH 05/10] [Github:MacOS] Add test for macos --- .github/workflows/actions.yml | 2 ++ scripts/tests/macos_test.sh | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 scripts/tests/macos_test.sh diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1195cad..53ce57f 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -64,6 +64,7 @@ jobs: python -m pip install pyqt6 && ./build.sh && cd ../client/dist && + bash ../../scripts/tests/macos_test.sh && ln -s /Applications "Applications (admin)" && hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg && zip -yr mac-portable.zip NSO-RPC.app/ @@ -90,6 +91,7 @@ jobs: cd scripts/macos-universal2 && bash ./build.sh && cd ../../client/dist && + bash ../../scripts/tests/macos_test.sh && ln -s /Applications "Applications (admin)" && hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg && zip -yr mac-universal2-portable.zip NSO-RPC.app/ diff --git a/scripts/tests/macos_test.sh b/scripts/tests/macos_test.sh new file mode 100644 index 0000000..c1a6d42 --- /dev/null +++ b/scripts/tests/macos_test.sh @@ -0,0 +1,25 @@ +#!/bin/bash +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' + +# Start the application in the background +./NSO-RPC.app/Contents/MacOS/NSO-RPC > output.log 2>&1 & +APP_PID=$! + +sleep 10 +kill $APP_PID + +output=$( Date: Tue, 14 May 2024 02:19:34 +0100 Subject: [PATCH 06/10] [Github:MacOS] Install pyqt6 inside of venv --- .github/workflows/actions.yml | 1 - scripts/build.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 53ce57f..0a323ff 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -61,7 +61,6 @@ jobs: - name: "Build" run: | cd scripts && - python -m pip install pyqt6 && ./build.sh && cd ../client/dist && bash ../../scripts/tests/macos_test.sh && diff --git a/scripts/build.sh b/scripts/build.sh index 78c3161..1da5d20 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,7 +2,7 @@ python3 -m venv --upgrade-deps venv source venv/bin/activate cd ../client -python3 -m pip install -r requirements.txt py2app GitPython +python3 -m pip install -r requirements.txt pyqt6 py2app GitPython python3 _version.py rm setup.py py2applet --make-setup app.py icon.icns "icon.png" "taskbarDark.png" "taskbarLight.png" "version.txt" From 8fc2506aa3a77fc6263a9661c77368efebc5eec0 Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Tue, 14 May 2024 02:29:24 +0100 Subject: [PATCH 07/10] [Github] Pin versions and Support PR's --- .github/workflows/actions.yml | 177 ++++++++++++++++++---------------- 1 file changed, 92 insertions(+), 85 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 0a323ff..98ede58 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -2,11 +2,13 @@ name: 'Build NSO-RPC - x86_64' on: release: types: [published] + pull_request: + types: [opened, synchronize] jobs: build-windows: name: 'Build NSO-RPC - Windows' - runs-on: windows-latest + runs-on: windows-2022 strategy: fail-fast: false matrix: @@ -14,104 +16,109 @@ jobs: - 'pyqt6' - 'pyqt5' steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.11.4 - - name: "Build" - run: | - python -m pip install ${{ matrix.pyqt_version }} && - cd scripts && - ./build.bat - - name: "Rename executable" - if: matrix.pyqt_version == 'pyqt5' - run: mv client/dist/NSO-RPC.exe client/dist/NSO-RPC-qt5.exe - - name: "Upload Build" - uses: softprops/action-gh-release@v2.0.4 - with: - files: | - client/dist/NSO-RPC*.exe + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11.4 + - name: "Build" + run: | + python -m pip install ${{ matrix.pyqt_version }} && + cd scripts && + ./build.bat + - name: "Rename executable" + if: matrix.pyqt_version == 'pyqt5' + run: mv client/dist/NSO-RPC.exe client/dist/NSO-RPC-qt5.exe + - name: "Upload Build" + if: github.event_name != 'pull_request' + uses: softprops/action-gh-release@v2.0.4 + with: + files: | + client/dist/NSO-RPC*.exe build-linux: name: 'Build NSO-RPC - Linux' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.11.4 - - name: "Upload script" - run: | - cd scripts && - chmod +x linux.sh - continue-on-error: false - - name: "Upload Build" - uses: softprops/action-gh-release@v2.0.4 - with: - files: scripts/linux.sh + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11.4 + - name: "Upload script" + run: | + cd scripts && + chmod +x linux.sh + continue-on-error: false + - name: "Upload Build" + if: github.event_name != 'pull_request' + uses: softprops/action-gh-release@v2.0.4 + with: + files: scripts/linux.sh build-macos: name: 'Build NSO-RPC - MacOS' - runs-on: macos-latest + runs-on: macos-12 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.11.4 - - name: "Build" - run: | - cd scripts && - ./build.sh && - cd ../client/dist && - bash ../../scripts/tests/macos_test.sh && - ln -s /Applications "Applications (admin)" && - hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg && - zip -yr mac-portable.zip NSO-RPC.app/ - - name: "Upload Build" - uses: softprops/action-gh-release@v2.0.4 - with: - files: | - client/dist/mac-installer.dmg - client/dist/mac-portable.zip + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11.4 + - name: "Build" + run: | + cd scripts && + ./build.sh && + cd ../client/dist && + bash ../../scripts/tests/macos_test.sh && + ln -s /Applications "Applications (admin)" && + hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg && + zip -yr mac-portable.zip NSO-RPC.app/ + - name: "Upload Build" + if: github.event_name != 'pull_request' + uses: softprops/action-gh-release@v2.0.4 + with: + files: | + client/dist/mac-installer.dmg + client/dist/mac-portable.zip build-universal2: name: 'Build NSO-RPC - Universal2' - runs-on: macos-latest + runs-on: macos-12 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.11.4 - - name: "Install Python 3.11.4 and build NSO-RPC" - run: | - curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg - sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target / && - alias python3=python3.11 - cd scripts/macos-universal2 && - bash ./build.sh && - cd ../../client/dist && - bash ../../scripts/tests/macos_test.sh && - ln -s /Applications "Applications (admin)" && - hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg && - zip -yr mac-universal2-portable.zip NSO-RPC.app/ - - name: "Upload NSO-RPC Universal2 Build" - uses: softprops/action-gh-release@v2.0.4 - with: - files: | - client/dist/mac-universal2-installer.dmg - client/dist/mac-universal2-portable.zip + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11.4 + - name: "Install Python 3.11.4 and build NSO-RPC" + run: | + curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg + sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target / && + alias python3=python3.11 + cd scripts/macos-universal2 && + bash ./build.sh && + cd ../../client/dist && + bash ../../scripts/tests/macos_test.sh && + ln -s /Applications "Applications (admin)" && + hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg && + zip -yr mac-universal2-portable.zip NSO-RPC.app/ + - name: "Upload NSO-RPC Universal2 Build" + if: github.event_name != 'pull_request' + uses: softprops/action-gh-release@v2.0.4 + with: + files: | + client/dist/mac-universal2-installer.dmg + client/dist/mac-universal2-portable.zip get-hashes: name: 'Generate Checksums' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: [build-windows, build-linux, build-macos, build-universal2] + if: github.event_name != 'pull_request' steps: - - name: "Generate checksums.txt" - uses: MCJack123/ghaction-generate-release-hashes@v4 - with: - hash-type: sha256 - file-name: checksums.txt - get-assets: true - - uses: softprops/action-gh-release@v2.0.4 - with: - files: checksums.txt + - name: "Generate checksums.txt" + uses: MCJack123/ghaction-generate-release-hashes@v4 + with: + hash-type: sha256 + file-name: checksums.txt + get-assets: true + - uses: softprops/action-gh-release@v2.0.4 + with: + files: checksums.txt From 7a40861ec85683250e15899de9b606c3f1c3be5c Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Tue, 14 May 2024 02:33:41 +0100 Subject: [PATCH 08/10] [Github] Dont include the test output.log file --- .github/workflows/actions.yml | 64 +++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 98ede58..4fb43c8 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -1,119 +1,125 @@ -name: 'Build NSO-RPC - x86_64' +--- +name: Build NSO-RPC - x86_64 on: release: - types: [published] + types: + - published pull_request: - types: [opened, synchronize] - + types: + - opened + - synchronize jobs: build-windows: - name: 'Build NSO-RPC - Windows' + name: Build NSO-RPC - Windows runs-on: windows-2022 strategy: fail-fast: false matrix: pyqt_version: - - 'pyqt6' - - 'pyqt5' + - pyqt6 + - pyqt5 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.11.4 - - name: "Build" + - name: Build run: | python -m pip install ${{ matrix.pyqt_version }} && cd scripts && ./build.bat - - name: "Rename executable" + - name: Rename executable if: matrix.pyqt_version == 'pyqt5' run: mv client/dist/NSO-RPC.exe client/dist/NSO-RPC-qt5.exe - - name: "Upload Build" + - name: Upload Build if: github.event_name != 'pull_request' uses: softprops/action-gh-release@v2.0.4 with: files: | client/dist/NSO-RPC*.exe - build-linux: - name: 'Build NSO-RPC - Linux' + name: Build NSO-RPC - Linux runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.11.4 - - name: "Upload script" + - name: Upload script run: | cd scripts && chmod +x linux.sh continue-on-error: false - - name: "Upload Build" + - name: Upload Build if: github.event_name != 'pull_request' uses: softprops/action-gh-release@v2.0.4 with: files: scripts/linux.sh - build-macos: - name: 'Build NSO-RPC - MacOS' + name: Build NSO-RPC - MacOS runs-on: macos-12 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.11.4 - - name: "Build" - run: | + - name: Build + run: > cd scripts && ./build.sh && cd ../client/dist && bash ../../scripts/tests/macos_test.sh && + rm output.log && ln -s /Applications "Applications (admin)" && hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-installer.dmg && zip -yr mac-portable.zip NSO-RPC.app/ - - name: "Upload Build" + - name: Upload Build if: github.event_name != 'pull_request' uses: softprops/action-gh-release@v2.0.4 with: files: | client/dist/mac-installer.dmg client/dist/mac-portable.zip - build-universal2: - name: 'Build NSO-RPC - Universal2' + name: Build NSO-RPC - Universal2 runs-on: macos-12 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: 3.11.4 - - name: "Install Python 3.11.4 and build NSO-RPC" - run: | - curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg + - name: Install Python 3.11.4 and build NSO-RPC + run: > + curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o + python-3.11.4-macos11.pkg sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target / && alias python3=python3.11 cd scripts/macos-universal2 && bash ./build.sh && cd ../../client/dist && bash ../../scripts/tests/macos_test.sh && + rm output.log && ln -s /Applications "Applications (admin)" && hdiutil create -fs HFS+ -srcfolder . -volname NSO-RPC mac-universal2-installer.dmg && zip -yr mac-universal2-portable.zip NSO-RPC.app/ - - name: "Upload NSO-RPC Universal2 Build" + - name: Upload NSO-RPC Universal2 Build if: github.event_name != 'pull_request' uses: softprops/action-gh-release@v2.0.4 with: files: | client/dist/mac-universal2-installer.dmg client/dist/mac-universal2-portable.zip - get-hashes: - name: 'Generate Checksums' + name: Generate Checksums runs-on: ubuntu-22.04 - needs: [build-windows, build-linux, build-macos, build-universal2] + needs: + - build-windows + - build-linux + - build-macos + - build-universal2 if: github.event_name != 'pull_request' steps: - - name: "Generate checksums.txt" + - name: Generate checksums.txt uses: MCJack123/ghaction-generate-release-hashes@v4 with: hash-type: sha256 From bc4a59a7859d89ecc4d65d15e3b2fd271f02c3d6 Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Tue, 14 May 2024 02:50:35 +0100 Subject: [PATCH 09/10] [Fix] Update _version.py to handle tags and PR's correctly --- client/_version.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/client/_version.py b/client/_version.py index b9fa3d4..dd655d5 100644 --- a/client/_version.py +++ b/client/_version.py @@ -1,15 +1,25 @@ import os import git + +def get_version_info(): + r = git.repo.Repo(search_parent_directories=True) + try: + # Get all tags sorted by commit date + tags = sorted(r.tags, key=lambda t: t.commit.committed_datetime, reverse=True) + version_info = tags[0].name + except IndexError: + try: + version_info = r.active_branch.name + except TypeError: + version_info = r.head.object.hexsha[:7] + return version_info + + if __name__ == '__main__': - # Deletes current version.txt file if os.path.exists('version.txt'): os.remove('version.txt') - # Writes latest git version info to 'version.txt' - r = git.repo.Repo(search_parent_directories=True) - version_info = r.git.describe('--tags') + version_info = get_version_info() with open('version.txt', 'w') as f: f.write(version_info) - f.write('\n') - f.close() From d0d02099dd71f4c3b05e10ce1e77401248ce5713 Mon Sep 17 00:00:00 2001 From: Phoenix / Hotaru Date: Tue, 14 May 2024 02:54:07 +0100 Subject: [PATCH 10/10] [Github:MacOS] Fix typo in curl --- .github/workflows/actions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 4fb43c8..71ed01c 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -20,6 +20,7 @@ jobs: - pyqt5 steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: 3.11.4 @@ -90,10 +91,9 @@ jobs: python-version: 3.11.4 - name: Install Python 3.11.4 and build NSO-RPC run: > - curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o - python-3.11.4-macos11.pkg + curl https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg -o python-3.11.4-macos11.pkg && sudo installer -verbose -pkg python-3.11.4-macos11.pkg -target / && - alias python3=python3.11 + alias python3=python3.11 && cd scripts/macos-universal2 && bash ./build.sh && cd ../../client/dist &&