From 356f835d3246ea4506c90c01a4145c4927cd975d Mon Sep 17 00:00:00 2001 From: deeplow Date: Thu, 3 Aug 2023 14:11:43 +0100 Subject: [PATCH] env.py: make env run in GUI mode (--no-gui otherwise) Now that we have GUI tests, it makes more sense to have running with the X11 socket mounted in the environment than not. --- .circleci/config.yml | 16 ++++++++-------- .github/workflows/ci.yml | 8 +++++++- dev_scripts/env.py | 12 ++++++------ dev_scripts/qa.py | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ebffe84..18493b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -178,7 +178,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro ubuntu --version 23.04 run -g --dev \ + ./dev_scripts/env.py --distro ubuntu --version 23.04 run --dev \ bash -c 'cd dangerzone; poetry run make test' ci-ubuntu-jammy: @@ -205,7 +205,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro ubuntu --version 22.04 run -g --dev \ + ./dev_scripts/env.py --distro ubuntu --version 22.04 run --dev \ bash -c 'cd dangerzone; poetry run make test' ci-ubuntu-focal: @@ -232,7 +232,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro ubuntu --version 20.04 run -g --dev \ + ./dev_scripts/env.py --distro ubuntu --version 20.04 run --dev \ bash -c 'cd dangerzone; poetry run make test' ci-fedora-38: @@ -259,7 +259,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro fedora --version 38 run -g --dev \ + ./dev_scripts/env.py --distro fedora --version 38 run --dev \ bash -c 'cd dangerzone; poetry run make test' ci-fedora-37: @@ -286,7 +286,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro fedora --version 37 run -g --dev \ + ./dev_scripts/env.py --distro fedora --version 37 run --dev \ bash -c 'cd dangerzone; poetry run make test' ci-debian-trixie: @@ -313,7 +313,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro debian --version trixie run -g --dev \ + ./dev_scripts/env.py --distro debian --version trixie run --dev \ bash -c 'cd dangerzone; poetry run make test' ci-debian-bookworm: @@ -340,7 +340,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro debian --version bookworm run -g --dev \ + ./dev_scripts/env.py --distro debian --version bookworm run --dev \ bash -c 'cd dangerzone; poetry run make test' # NOTE: Making CI tests work in Debian Bullseye requires some tip-toeing @@ -400,7 +400,7 @@ jobs: - run: name: Run CI tests command: | - ./dev_scripts/env.py --distro debian --version bullseye run -g --dev \ + ./dev_scripts/env.py --distro debian --version bullseye run --dev \ bash -c 'cd dangerzone; poetry run make test' build-ubuntu-lunar: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 011477d..2788366 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: run: | ./dev_scripts/env.py --distro ${{ env.distro }} \ --version ${{ env.version }} \ - run --dev ./dangerzone/install/linux/build-deb.py + run --dev --no-gui ./dangerzone/install/linux/build-deb.py - name: Upload Dangerzone .deb uses: actions/upload-artifact@v3 @@ -151,3 +151,9 @@ jobs: ./dev_scripts/env.py --distro ${{ matrix.distro }} \ --version ${{ matrix.version }} \ run dangerzone-cli dangerzone/tests/test_docs/sample-pdf.pdf + + - name: Check that the Dangerzone GUI imports work + run: | + ./dev_scripts/env.py --distro ${{ matrix.distro }} \ + --version ${{ matrix.version }} \ + run dangerzone --help diff --git a/dev_scripts/env.py b/dev_scripts/env.py index 56612f4..f874478 100755 --- a/dev_scripts/env.py +++ b/dev_scripts/env.py @@ -7,7 +7,7 @@ import shutil import subprocess import sys -DEFAULT_GUI = False +DEFAULT_GUI = True DEFAULT_USER = "user" DEFAULT_DRY = False DEFAULT_DEV = False @@ -42,13 +42,13 @@ Run an interactive shell in the development or end-user environment: Run Dangerzone in the development environment: - env.py --distro ubuntu --version 22.04 run --dev --gui bash + env.py --distro ubuntu --version 22.04 run --dev bash user@dangerzone-dev:~$ cd dangerzone/ user@dangerzone-dev:~$ poetry run ./dev/scripts/dangerzone Run Dangerzone in the end-user environment: - env.py --distro ubuntu --version 22.04 run --gui dangerzone + env.py --distro ubuntu --version 22.04 run dangerzone """ @@ -566,10 +566,10 @@ def parse_args(): ) parser_run.set_defaults(func=env_run) parser_run.add_argument( - "-g", - "--gui", + "--no-gui", default=DEFAULT_GUI, - action="store_true", + action="store_false", + dest="gui", help="Run command with GUI support", ) parser_run.add_argument( diff --git a/dev_scripts/qa.py b/dev_scripts/qa.py index f8aa484..5037a31 100755 --- a/dev_scripts/qa.py +++ b/dev_scripts/qa.py @@ -619,7 +619,7 @@ class QABase(abc.ABC): "", f" cd {self.src}", f" ./dev_scripts/env.py --distro {self.DISTRO} --version" - f" {self.VERSION} run -g bash", + f" {self.VERSION} run bash", "", "and run either `dangerzone` or `dangerzone-cli`", )