From db3e2167047a27f8152ed7f0dd6777f1ae5d3e40 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 17 Jun 2024 13:41:17 -0400 Subject: [PATCH 1/6] test that installers do not exit immediately --- .github/workflows/build-linux-installer-deb.yml | 2 +- .github/workflows/build-linux-installer-rpm.yml | 2 +- .github/workflows/build-macos-installers.yml | 2 +- .github/workflows/build-windows-installer.yml | 2 +- chia/cmds/installers.py | 16 ++++++++++++++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index de813fac016c..5c78e37245b9 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -423,7 +423,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain - name: Verify /opt/chia present run: | diff --git a/.github/workflows/build-linux-installer-rpm.yml b/.github/workflows/build-linux-installer-rpm.yml index c8ed3c75b5fc..a2d22dc64b2d 100644 --- a/.github/workflows/build-linux-installer-rpm.yml +++ b/.github/workflows/build-linux-installer-rpm.yml @@ -420,7 +420,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain - name: Verify /opt/chia present run: | diff --git a/.github/workflows/build-macos-installers.yml b/.github/workflows/build-macos-installers.yml index b5f4bc8d2e42..264a7ed48574 100644 --- a/.github/workflows/build-macos-installers.yml +++ b/.github/workflows/build-macos-installers.yml @@ -457,7 +457,7 @@ jobs: - name: Run chia dev installers test run: | - "/Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + "/Volumes/Chia "*"/Chia.app/Contents/Resources/app.asar.unpacked/daemon/chia" dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command open --gui-command "/Volumes/Chia "*/Chia.app - name: Detach .dmg if: always() diff --git a/.github/workflows/build-windows-installer.yml b/.github/workflows/build-windows-installer.yml index c63e0b0b1c42..58352cd44c17 100644 --- a/.github/workflows/build-windows-installer.yml +++ b/.github/workflows/build-windows-installer.yml @@ -434,4 +434,4 @@ jobs: env: INSTALL_PATH: ${{ github.workspace }}\installed run: | - & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" + & ($env:INSTALL_PATH + "\resources\app.asar.unpacked\daemon\chia.exe") dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command ($env:INSTALL_PATH + "\Chia.exe") diff --git a/chia/cmds/installers.py b/chia/cmds/installers.py index 8ffed570146c..58a3a197d803 100644 --- a/chia/cmds/installers.py +++ b/chia/cmds/installers.py @@ -3,7 +3,7 @@ import json import subprocess import tempfile -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Sequence import click import packaging.version @@ -50,7 +50,8 @@ def installers_group() -> None: @installers_group.command(name="test") @click.option("--expected-chia-version", "expected_chia_version_str", required=True) @click.option("--require-madmax/--require-no-madmax", "require_madmax", default=True) -def test_command(expected_chia_version_str: str, require_madmax: bool) -> None: +@click.option("--gui-command", multiple=True, required=True) +def test_command(expected_chia_version_str: str, require_madmax: bool, gui_command: Sequence[str]) -> None: print("testing installed executables") expected_chia_version = packaging.version.Version(expected_chia_version_str) @@ -127,3 +128,14 @@ def test_command(expected_chia_version_str: str, require_madmax: bool) -> None: check=True, timeout=adjusted_timeout(30), ) + + try: + subprocess.run( + args=gui_command, + check=True, + timeout=adjusted_timeout(30), + ) + except subprocess.TimeoutExpired: + pass + else: + raise Exception("process terminated prior to timeout") From 93cc7c7773dab5ddbd920bcbdd59a57d4dbbeca6 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 17 Jun 2024 13:51:44 -0400 Subject: [PATCH 2/6] only for gui mode testing --- .../workflows/build-linux-installer-deb.yml | 6 +++-- .../workflows/build-linux-installer-rpm.yml | 2 +- chia/cmds/installers.py | 23 ++++++++++--------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index 5c78e37245b9..dfeb1d722121 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -382,9 +382,11 @@ jobs: url: "docker://ubuntu:noble" mode: - name: GUI + matrix: gui file: chia-blockchain_*.deb package: chia-blockchain - name: CLI + matrix: cli file: chia-blockchain-cli_*.deb package: chia-blockchain-cli arch: @@ -423,7 +425,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain + chia dev installers test --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" ${{ matrix.mode.matrix == 'gui' && '--gui-command chia-blockchain' || '' }} - name: Verify /opt/chia present run: | @@ -435,7 +437,7 @@ jobs: - name: Check permissions of /opt/chia/chrome-sandbox shell: bash - if: matrix.mode.name == 'GUI' + if: matrix.mode.matrix == 'gui' run: | [ $(stat -c %a:%G:%U /opt/chia/chrome-sandbox) == "4755:root:root" ] diff --git a/.github/workflows/build-linux-installer-rpm.yml b/.github/workflows/build-linux-installer-rpm.yml index a2d22dc64b2d..5e0a8d6e500e 100644 --- a/.github/workflows/build-linux-installer-rpm.yml +++ b/.github/workflows/build-linux-installer-rpm.yml @@ -420,7 +420,7 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" --gui-command chia-blockchain + chia dev installers test --require-no-madmax --expected-chia-version "${{ needs.build.outputs.chia-installer-version }}" ${{ matrix.mode.matrix == 'gui' && '--gui-command chia-blockchain' || '' }} - name: Verify /opt/chia present run: | diff --git a/chia/cmds/installers.py b/chia/cmds/installers.py index 58a3a197d803..e753a07da742 100644 --- a/chia/cmds/installers.py +++ b/chia/cmds/installers.py @@ -50,7 +50,7 @@ def installers_group() -> None: @installers_group.command(name="test") @click.option("--expected-chia-version", "expected_chia_version_str", required=True) @click.option("--require-madmax/--require-no-madmax", "require_madmax", default=True) -@click.option("--gui-command", multiple=True, required=True) +@click.option("--gui-command", multiple=True) def test_command(expected_chia_version_str: str, require_madmax: bool, gui_command: Sequence[str]) -> None: print("testing installed executables") expected_chia_version = packaging.version.Version(expected_chia_version_str) @@ -129,13 +129,14 @@ def test_command(expected_chia_version_str: str, require_madmax: bool, gui_comma timeout=adjusted_timeout(30), ) - try: - subprocess.run( - args=gui_command, - check=True, - timeout=adjusted_timeout(30), - ) - except subprocess.TimeoutExpired: - pass - else: - raise Exception("process terminated prior to timeout") + if len(gui_command) > 0: + try: + subprocess.run( + args=gui_command, + check=True, + timeout=adjusted_timeout(30), + ) + except subprocess.TimeoutExpired: + pass + else: + raise Exception("process terminated prior to timeout") From aee04b8f533bef3719c0fb43624cae55eab7ad56 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 17 Jun 2024 14:17:03 -0400 Subject: [PATCH 3/6] print _something_ --- chia/cmds/installers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chia/cmds/installers.py b/chia/cmds/installers.py index e753a07da742..35071cb1aa1d 100644 --- a/chia/cmds/installers.py +++ b/chia/cmds/installers.py @@ -2,6 +2,7 @@ import json import subprocess +import sys import tempfile from typing import Dict, List, Optional, Sequence @@ -129,7 +130,11 @@ def test_command(expected_chia_version_str: str, require_madmax: bool, gui_comma timeout=adjusted_timeout(30), ) - if len(gui_command) > 0: + if len(gui_command) == 0: + print("skipping gui launch test") + else: + print(f"launching: {gui_command}") + sys.stdout.flush() try: subprocess.run( args=gui_command, From 02c898ec9a4af769eae1637e3c7ed8535c69e119 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 19 Aug 2024 11:16:03 -0400 Subject: [PATCH 4/6] / --- .github/workflows/build-windows-installer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-windows-installer.yml b/.github/workflows/build-windows-installer.yml index 9a0e5259bdb6..c6f8df2a7751 100644 --- a/.github/workflows/build-windows-installer.yml +++ b/.github/workflows/build-windows-installer.yml @@ -356,4 +356,4 @@ jobs: - name: Run chia dev installers test run: | - & ($env:INSTALL_PATH + "/resources/app.asar.unpacked/daemon/chia.exe") dev installers test --expected-chia-version "${{ needs.version.outputs.chia-installer-version }}" --gui-command ($env:INSTALL_PATH + "\Chia.exe") + & ($env:INSTALL_PATH + "/resources/app.asar.unpacked/daemon/chia.exe") dev installers test --expected-chia-version "${{ needs.version.outputs.chia-installer-version }}" --gui-command ($env:INSTALL_PATH + "/Chia.exe") From 1a7c113363683e747e7ff9f2b5358661199dc91b Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Aug 2025 14:20:30 -0400 Subject: [PATCH 5/6] webtop --- .github/workflows/build-linux-installer-deb.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index 233b6248d85f..fa64bc98bed9 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -261,14 +261,20 @@ jobs: type: debian # https://packages.debian.org/bookworm/python/python3 (3.11) url: "docker://debian:bookworm" + skip: gui - name: ubuntu:jammy (22.04) type: ubuntu # https://packages.ubuntu.com/jammy/python3 (22.04, 3.10) url: "docker://ubuntu:jammy" + skip: gui - name: ubuntu:noble (24.04) type: ubuntu # https://packages.ubuntu.com/noble/python3 (24.04, 3.12) url: "docker://ubuntu:noble" + skip: gui + - name: webtop:ubuntu-kde + type: ubuntu + url: lscr.io/linuxserver/webtop:ubuntu-kde mode: - name: GUI matrix: gui @@ -285,6 +291,15 @@ jobs: - name: Intel matrix: intel artifact-name: intel + exclude: + - mode: + matrix: gui + distribution: + skip: gui + - mode: + matrix: cli + distribution: + skip: cli env: DEBIAN_FRONTEND: noninteractive From e080ae2a911a8e9134164c9ef77308d32fdbc29d Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 20 Aug 2025 14:50:42 -0400 Subject: [PATCH 6/6] test as non-root user --- .github/workflows/build-linux-installer-deb.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index fa64bc98bed9..d4ef8d61ad45 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -329,7 +329,12 @@ jobs: - name: Run chia dev installers test run: | - chia dev installers test --expected-chia-version "${{ needs.version.outputs.chia-installer-version }}" ${{ matrix.mode.matrix == 'gui' && '--gui-command chia-blockchain' || '' }} + USERNAME=testuser + USER_UID=2001 + USER_GID=${USER_UID} + groupadd --gid $USER_GID $USERNAME + useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + su $USERNAME -c 'chia dev installers test --expected-chia-version "${{ needs.version.outputs.chia-installer-version }}" ${{ matrix.mode.matrix == 'gui' && '--gui-command chia-blockchain' || '' }}' - name: Verify /opt/chia present run: |