diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 76b2f86..b4e8c93 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.6 +current_version = 0.1.0 commit = False tag = False allow_dirty = True diff --git a/.github/workflows/iris-wallet-desktop.yml b/.github/workflows/iris-wallet-desktop.yml index 17c42c4..b07ca3d 100644 --- a/.github/workflows/iris-wallet-desktop.yml +++ b/.github/workflows/iris-wallet-desktop.yml @@ -1,49 +1,51 @@ name: Iris Wallet Desktop CI on: - workflow_dispatch: + push: + tags: + - '*' # Trigger this workflow on any tag push jobs: - build-linux: + build-iris-wallet-desktop: runs-on: ubuntu-22.04 steps: - - name: Checkout code with submodules + - name: Checkout repository with submodules uses: actions/checkout@v3 with: - submodules: true - fetch-depth: 1 - submodule-fetch-depth: 1 + submodules: true # Include submodules in the checkout + fetch-depth: 1 # Fetch the latest commit only - - name: Install Rust + - name: Install Rust Programming Environment run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo "$HOME/.cargo/bin" >> $GITHUB_PATH source "$HOME/.cargo/env" - - name: Set up Python 3.12.3 + - name: Set up Python 3.12.3 environment uses: actions/setup-python@v5 with: python-version: "3.12.3" - - name: Install dependencies + - name: Install required system dependencies run: | sudo apt update - sudo apt install libxcb-cursor0 -y - sudo apt-get install ruby-dev build-essential && sudo gem i fpm -f + sudo apt install libxcb-cursor0 -y # Required by the application + sudo apt-get install ruby-dev build-essential -y && sudo gem i fpm -f + sudo apt-get update && sudo apt-get install -y libfuse2 # Required for AppImage creation - name: Clone rgb-lightning-node repository with submodules run: git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules - name: Build the rgb-lightning-node binary working-directory: rgb-lightning-node - run: cargo install --debug --path . + run: cargo install --locked --debug --path . - name: Copy rgb-lightning-node binary to root directory run: | mkdir ln_node_binary cp rgb-lightning-node/target/debug/rgb-lightning-node ln_node_binary - - name: Set environment variables from secrets and create config.py + - name: Set environment variables from GitHub Secrets and generate config.py env: CLIENT_ID: ${{ secrets.CLIENT_ID }} PROJECT_ID: ${{ secrets.PROJECT_ID }} @@ -51,203 +53,76 @@ jobs: TOKEN_URI: ${{ secrets.TOKEN_URI }} AUTH_PROVIDER_CERT_URL: ${{ secrets.AUTH_PROVIDER_CERT_URL }} CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + SMTP_EMAIL_ID: ${{ secrets.SMTP_EMAIL_ID }} + SMTP_EMAIL_TOKEN: ${{ secrets.SMTP_EMAIL_TOKEN }} + SUPPORT_EMAIL: ${{ secrets.SUPPORT_EMAIL }} + SMTP_HOST: ${{ secrets.SMTP_HOST }} + SMTP_PORT: ${{ secrets.SMTP_PORT }} run: | cd src/utils python generate_config.py - - name: Install python dependencies + - name: Install Python dependencies run: | - pip install poetry - pip install pyinstaller - poetry install + pip install poetry # Dependency management tool + pip install pyinstaller # Required for building executable files + poetry install # Install application dependencies - name: Compile QT resources run: | poetry run pyside6-rcc src/resources.qrc -o src/resources_rc.py - - name: Build the application + - name: Create AppImage for Regtest network run: | - chmod +x build_linux.sh - ./build_linux.sh - - - name: Create AppImage - run: | - chmod +x build_appimage.sh - ./build_appimage.sh ARCH=$(uname -m) - APPIMAGE_NAME="iriswallet-${ARCH}.AppImage" - echo "APPIMAGE_NAME=${APPIMAGE_NAME}" >> $GITHUB_ENV - echo $APPIMAGE_NAME - - - name: Upload Linux artifact - uses: actions/upload-artifact@v4 - with: - name: linux - path: | - iriswallet.deb - - - name: Upload AppImage artifact - uses: actions/upload-artifact@v4 - with: - name: linux_appimage - path: | - ${{ env.APPIMAGE_NAME }} - - build-macos: - runs-on: macos-latest - steps: - - name: Checkout code with submodules - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 1 - submodule-fetch-depth: 1 - - - name: Install Rust - run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - source "$HOME/.cargo/env" - - - name: Set up Python 3.12.3 - uses: actions/setup-python@v5 - with: - python-version: "3.12.3" - - - name: Clone rgb-lightning-node repository with submodules - run: git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules - - - name: Build the rgb-lightning-node binary - working-directory: rgb-lightning-node - run: cargo install --debug --path . - - - name: Copy rgb-lightning-node binary to root directory - run: | - mkdir ln_node_binary - cp rgb-lightning-node/target/debug/rgb-lightning-node ln_node_binary - - - name: Set environment variables from secrets and create config.py - env: - CLIENT_ID: ${{ secrets.CLIENT_ID }} - PROJECT_ID: ${{ secrets.PROJECT_ID }} - AUTH_URI: ${{ secrets.AUTH_URI }} - TOKEN_URI: ${{ secrets.TOKEN_URI }} - AUTH_PROVIDER_CERT_URL: ${{ secrets.AUTH_PROVIDER_CERT_URL }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - run: | - cd src/utils - python generate_config.py - - - name: Install python dependencies - run: | - pip install poetry - pip install pyinstaller - poetry install - - - name: Compile QT resources - run: | - poetry run pyside6-rcc src/resources.qrc -o src/resources_rc.py - - - name: Build the application - run: | - chmod +x build_macos.sh - ./build_macos.sh - - - name: Upload macOS artifact + VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2) + poetry run build-iris-wallet --network=regtest --distribution=appimage + REGTEST_APPIMAGE_NAME="iriswallet-${VERSION}-${ARCH}.AppImage" + RENAME_REGTEST_APPIMAGE_NAME="iriswallet-regtest-${VERSION}-${ARCH}.AppImage" + mv ${REGTEST_APPIMAGE_NAME} ${RENAME_REGTEST_APPIMAGE_NAME} + echo "RENAME_REGTEST_APPIMAGE_NAME=${RENAME_REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV + echo "Generated file: $RENAME_REGTEST_APPIMAGE_NAME" + shell: bash + + - name: Upload Regtest AppImage artifact uses: actions/upload-artifact@v4 with: - name: macos - path: iriswallet* + name: linux_appimage_regtest + path: ${{ env.RENAME_REGTEST_APPIMAGE_NAME }} - build-windows: - runs-on: windows-latest - steps: - - name: Checkout code with submodules - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 1 - submodule-fetch-depth: 1 - - - name: Install Rust + - name: Create AppImage for Testnet network run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Clone rgb-lightning-node repository with submodules - run: git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules - - - name: Build the rgb-lightning-node binary - working-directory: rgb-lightning-node - run: cargo install --debug --path . - - - name: Copy rgb-lightning-node binary to root directory - run: | - mkdir ln_node_binary - copy rgb-lightning-node\\target\\debug\\rgb-lightning-node.exe ln_node_binary - - - name: Generate config.py with secrets and inno Setup script with dynamic version - env: - CLIENT_ID: ${{ secrets.CLIENT_ID }} - PROJECT_ID: ${{ secrets.PROJECT_ID }} - AUTH_URI: ${{ secrets.AUTH_URI }} - TOKEN_URI: ${{ secrets.TOKEN_URI }} - AUTH_PROVIDER_CERT_URL: ${{ secrets.AUTH_PROVIDER_CERT_URL }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - run: | - cd src/utils - python generate_config.py - python generate_iss.py - - - name: Install python dependencies - run: | - pip install poetry - pip install pyinstaller - poetry install - - - name: Compile QT resources and build exe - run: | - poetry run pyside6-rcc src/resources.qrc -o src/resources_rc.py - poetry run pyinstaller iris_wallet_desktop.spec - - - name: Build the application - uses: Minionguyjpro/Inno-Setup-Action@v1.2.2 - with: - path: updated_iriswallet.iss - - - name: Upload Windows artifact + ARCH=$(uname -m) + VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2) + poetry run build-iris-wallet --network=testnet --distribution=appimage + TESTNET_APPIMAGE_NAME="iriswallet-${VERSION}-${ARCH}.AppImage" + RENAME_TESTNET_APPIMAGE_NAME="iriswallet-testnet-${VERSION}-${ARCH}.AppImage" + mv ${TESTNET_APPIMAGE_NAME} ${RENAME_TESTNET_APPIMAGE_NAME} + echo "RENAME_TESTNET_APPIMAGE_NAME=${RENAME_TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV + echo "Generated file: $RENAME_TESTNET_APPIMAGE_NAME" + shell: bash + + - name: Upload Testnet AppImage artifact uses: actions/upload-artifact@v4 with: - name: windows - path: iriswallet.exe + name: linux_appimage_testnet + path: ${{ env.RENAME_TESTNET_APPIMAGE_NAME }} - - upload-release: - if: needs.build-linux.result == 'success' || needs.build-macos.result == 'success' || needs.build-windows.result == 'success' + release-artifacts: + if: needs.build-iris-wallet-desktop.result == 'success' runs-on: ubuntu-latest - needs: [build-linux, build-macos, build-windows] + needs: [build-iris-wallet-desktop] permissions: contents: write steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Read version from VERSION.py + - name: Retrieve tag name run: | - VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2) - echo "TAG_NAME=v${VERSION}" >> $GITHUB_ENV - echo "RELEASE_NAME=Release v${VERSION}" >> $GITHUB_ENV - ARCH=$(uname -m) - APPIMAGE_NAME="iriswallet-${ARCH}.AppImage" - echo "APPIMAGE_NAME=${APPIMAGE_NAME}" >> $GITHUB_ENV - echo $APPIMAGE_NAME - APPNAME_MAC="iriswallet ${VERSION}".dmg - echo "APPNAME_MAC=${APPNAME_MAC}" >> $GITHUB_ENV - echo $APPNAME_MAC - + TAG_NAME=$(git describe --tags) + echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV + echo "Using tag: $TAG_NAME" - name: Create GitHub Release id: create_release @@ -256,89 +131,67 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: "${{ env.TAG_NAME }}" - release_name: "${{ env.RELEASE_NAME }}" + release_name: "${{ env.TAG_NAME }}" draft: false prerelease: false - - name: Create uploads folder + - name: Read version and architecture information + run: | + VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2) + ARCH=$(uname -m) + TESTNET_APPIMAGE_NAME="iriswallet-testnet-${VERSION}-${ARCH}.AppImage" + REGTEST_APPIMAGE_NAME="iriswallet-regtest-${VERSION}-${ARCH}.AppImage" + echo "ARCH=${ARCH}" >> $GITHUB_ENV + echo "TESTNET_APPIMAGE_NAME=${TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV + echo "REGTEST_APPIMAGE_NAME=${REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV + + - name: Prepare uploads folder run: mkdir -p ./uploads - - name: Download Linux artifact + - name: Download Testnet AppImage artifact uses: actions/download-artifact@v4 with: - name: linux # Name of the Linux artifact - path: ./uploads # Destination path folder + name: linux_appimage_testnet + path: ./uploads/testnet - - name: Download Linux AppImage artifact + - name: Download Regtest AppImage artifact uses: actions/download-artifact@v4 with: - name: linux_appimage # Name of the Linux artifact - path: ./uploads # Destination path folder - - name: Download macOS artifact - uses: actions/download-artifact@v4 - with: - name: macos # Name of the macOS artifact - path: ./uploads # Destination path folder + name: linux_appimage_regtest + path: ./uploads/regtest - - name: Download windows artifact - uses: actions/download-artifact@v4 - with: - name: windows # Name of the windows artifact - path: ./uploads # Destination path folder - - - name: Upload Release Artifact Linux DEB - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./uploads/iriswallet.deb - asset_name: iris-wallet-desktop-linux-"${{ env.TAG_NAME }}".deb - asset_content_type: application/vnd.debian.binary-package - - - name: Upload Release Artifact Linux AppImage + - name: Upload Testnet AppImage to GitHub Release uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./uploads/${{ env.APPIMAGE_NAME }} - asset_name: iris-wallet-desktop-"${{ env.TAG_NAME }}".AppImage + asset_path: ./uploads/testnet/${{ env.TESTNET_APPIMAGE_NAME }} + asset_name: iris-wallet-${{ env.TAG_NAME }}-testnet-${{env.ARCH}}.AppImage asset_content_type: application/octet-stream - - name: Upload Release Artifact windows - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./uploads/iriswallet.exe - asset_name: iris-wallet-desktop-windows-"${{ env.TAG_NAME }}".exe - asset_content_type: application/vnd.microsoft.portable-executable - - - name: Upload Release Artifact macOS + - name: Upload Regtest AppImage to GitHub Release uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./uploads/${{ env.APPNAME_MAC }} - asset_name: iris-wallet-desktop-macos-"${{ env.TAG_NAME }}".dmg + asset_path: ./uploads/regtest/${{ env.REGTEST_APPIMAGE_NAME }} + asset_name: iris-wallet-${{ env.TAG_NAME }}-regtest-${{env.ARCH}}.AppImage asset_content_type: application/octet-stream - cleanup: + cleanup-artifacts: if: always() runs-on: ubuntu-latest - needs: [build-linux, build-macos, build-windows,upload-release] + needs: [build-iris-wallet-desktop, release-artifacts] steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Cleanup Artifacts + - name: Delete Artifacts from Workflow Run uses: geekyeggo/delete-artifact@v5 with: name: | - linux - linux_appimage - macos - windows + linux_appimage_regtest + linux_appimage_testnet failOnError: false diff --git a/README.md b/README.md index 81844dd..c01abbf 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,9 @@ client_config = { # Config for the error report email server report_email_server_config = { - 'email_id': 'your_email_id', - 'email_token': 'your_email_token', + 'smtp_email_id': 'smtp_server_email_id', + 'smtp_email_token': 'smtp_server_email_token', + 'support_email': 'support_email_id', 'smtp_host': 'smtp.gmail.com', 'smtp_port': '587' } diff --git a/pyproject.toml b/pyproject.toml index 97f6708..0cea446 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "iris-wallet-desktop" -version = "0.0.6" +version = "0.1.0" description = "" readme = "README.md" license = "" diff --git a/src/utils/common_utils.py b/src/utils/common_utils.py index 8a774b5..e225a70 100644 --- a/src/utils/common_utils.py +++ b/src/utils/common_utils.py @@ -524,8 +524,8 @@ def send_crash_report(email_to, subject, body, zip_file_path): - Connects to the SMTP server using TLS, authenticates with the email ID and token, and sends the email. - Handles any exceptions that occur during the email sending process by showing an error toast message. """ - email_id = report_email_server_config['email_id'] - email_token = report_email_server_config['email_token'] + email_id = report_email_server_config['smtp_email_id'] + email_token = report_email_server_config['smtp_email_token'] # Create a multipart message msg = MIMEMultipart() diff --git a/src/utils/constant.py b/src/utils/constant.py index 750f5cc..562b827 100644 --- a/src/utils/constant.py +++ b/src/utils/constant.py @@ -66,10 +66,10 @@ BITCOIND_RPC_USER_REGTEST = 'user' BITCOIND_RPC_PASSWORD_REGTEST = 'password' -BITCOIND_RPC_HOST_REGTEST = 'localhost' -BITCOIND_RPC_PORT_REGTEST = 18443 -INDEXER_URL_REGTEST = '127.0.0.1:50001' -PROXY_ENDPOINT_REGTEST = 'rpc://127.0.0.1:3000/json-rpc' +BITCOIND_RPC_HOST_REGTEST = 'regtest-bitcoind.rgbtools.org' +BITCOIND_RPC_PORT_REGTEST = 80 +INDEXER_URL_REGTEST = 'electrum.rgbtools.org:50041' +PROXY_ENDPOINT_REGTEST = 'rpcs://proxy.iriswallet.com/0.2/json-rpc' LDK_DATA_NAME_REGTEST = 'dataldkregtest' BITCOIND_RPC_USER_TESTNET = 'user' diff --git a/src/utils/generate_config.py b/src/utils/generate_config.py index c3d06a5..419496c 100644 --- a/src/utils/generate_config.py +++ b/src/utils/generate_config.py @@ -12,13 +12,38 @@ import os + +def get_env_var(key, default=None): + """ + Returns the value of an environment variable, or a default value if the variable + is not set or is an empty string. + + Args: + key (str): The name of the environment variable. + default (Any): The fallback value if the variable is not set or is empty. + + Returns: + Any: The environment variable's value or the default. + """ + value = os.getenv(key, default) + # If the value is an empty string, return the default + return value if value else default + + # Read environment variables -client_id = os.getenv('CLIENT_ID') -project_id = os.getenv('PROJECT_ID') -auth_uri = os.getenv('AUTH_URI') -token_uri = os.getenv('TOKEN_URI') -auth_provider_cert_url = os.getenv('AUTH_PROVIDER_CERT_URL') -client_secret = os.getenv('CLIENT_SECRET') +client_id = get_env_var('CLIENT_ID') +project_id = get_env_var('PROJECT_ID') +auth_uri = get_env_var('AUTH_URI', 'https://accounts.google.com/o/oauth2/auth') +token_uri = get_env_var('TOKEN_URI', 'https://oauth2.googleapis.com/token') +auth_provider_cert_url = get_env_var( + 'AUTH_PROVIDER_CERT_URL', 'https://www.googleapis.com/oauth2/v1/certs', +) +client_secret = get_env_var('CLIENT_SECRET') +smtp_email_id = get_env_var('SMTP_EMAIL_ID') +smtp_email_token = get_env_var('SMTP_EMAIL_TOKEN') +support_email = get_env_var('SUPPORT_EMAIL') +smtp_host = get_env_var('SMTP_HOST', 'smtp.gmail.com') +smtp_port = get_env_var('SMTP_PORT', '587') # Create the content of config.py config_content = f""" @@ -32,6 +57,14 @@ 'client_secret': '{client_secret}', }}, }} + +report_email_server_config = {{ + 'smtp_email_id': '{smtp_email_id}', + 'smtp_email_token': '{smtp_email_token}', + 'support_email': '{support_email}', + 'smtp_host': '{smtp_host}', + 'smtp_port': '{smtp_port}' +}} """ # Write the content to config.py diff --git a/src/version.py b/src/version.py index 7299b46..edadef9 100644 --- a/src/version.py +++ b/src/version.py @@ -6,4 +6,4 @@ """ from __future__ import annotations -__version__ = '0.0.6' +__version__ = '0.1.0' diff --git a/src/views/components/error_report_dialog_box.py b/src/views/components/error_report_dialog_box.py index 2fb85e9..7a24e1d 100644 --- a/src/views/components/error_report_dialog_box.py +++ b/src/views/components/error_report_dialog_box.py @@ -99,7 +99,7 @@ def on_button_clicked(self, button): subject = f"Iris Wallet Error Report - Version {__version__}" title = 'Error Report for Iris Wallet Desktop' body = generate_error_report_email(url=self.url, title=title) - email_id = report_email_server_config['email_id'] + email_id = report_email_server_config['support_email'] send_crash_report_async(email_id, subject, body, zip_file_path) elif button == self.button(QMessageBox.No): diff --git a/unit_tests/tests/ui_tests/components/error_report_dialog_box_test.py b/unit_tests/tests/ui_tests/components/error_report_dialog_box_test.py index 9e7a5f7..cad92f3 100644 --- a/unit_tests/tests/ui_tests/components/error_report_dialog_box_test.py +++ b/unit_tests/tests/ui_tests/components/error_report_dialog_box_test.py @@ -55,7 +55,13 @@ def test_send_report_on_yes_button(error_report_dialog): patch('src.views.components.error_report_dialog_box.shutil.make_archive') as mock_archive, \ patch('src.views.components.error_report_dialog_box.generate_error_report_email') as mock_generate_email, \ patch('src.views.components.error_report_dialog_box.send_crash_report_async') as mock_send_email, \ - patch('src.views.components.error_report_dialog_box.report_email_server_config', {'email_id': 'dummy_email_id'}): # Mock email config dictionary + patch( + 'src.views.components.error_report_dialog_box.report_email_server_config', + { + 'smtp_email_id': 'dummy_email_id', + 'support_email': 'dummy_support_email', + }, + ): # Mock return values for external functions mock_zip.return_value = ('dummy_dir', 'output_dir') @@ -82,7 +88,7 @@ def test_send_report_on_yes_button(error_report_dialog): # Verify that the email sending function was called with correct parameters mock_send_email.assert_called_once_with( - 'dummy_email_id', # The mocked email ID + 'dummy_support_email', f"Iris Wallet Error Report - Version {__version__}", 'dummy email body', 'dummy_path.zip',