From fd6508116ce149bad9d9b5b486f8fd5aad3f53e1 Mon Sep 17 00:00:00 2001 From: priyamsahoo Date: Mon, 12 Feb 2024 20:30:50 +0530 Subject: [PATCH] install xvfb before running in CI --- tools/test-setup.sh | 2 +- tools/vscode.sh | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 869db09f..7b594598 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -68,7 +68,7 @@ if [[ -f "/usr/bin/apt-get" ]]; then INSTALL=0 # qemu-user-static is required by podman on arm64 # python3-dev is needed for headers as some packages might need to compile - DEBS=(curl git python3-dev python3-venv python3-pip qemu-user-static) + DEBS=(curl git python3-dev python3-venv python3-pip qemu-user-static xvfb x11-xserver-utils) for DEB in "${DEBS[@]}"; do [[ "$(dpkg-query --show --showformat='${db:Status-Status}\n' \ "${DEB}" || true)" != 'installed' ]] && INSTALL=1 diff --git a/tools/vscode.sh b/tools/vscode.sh index e6cc1962..c6a91171 100755 --- a/tools/vscode.sh +++ b/tools/vscode.sh @@ -16,6 +16,31 @@ asdf local nodejs latest:18 unset VIRTUAL_ENV +if [[ -f "/usr/bin/apt-get" ]]; then + INSTALL=0 + # qemu-user-static is required by podman on arm64 + # python3-dev is needed for headers as some packages might need to compile + DEBS=(curl git python3-dev python3-venv python3-pip qemu-user-static xvfb x11-xserver-utils) + for DEB in "${DEBS[@]}"; do + [[ "$(dpkg-query --show --showformat='${db:Status-Status}\n' \ + "${DEB}" || true)" != 'installed' ]] && INSTALL=1 + done + if [[ "${INSTALL}" -eq 1 ]]; then + log warning "We need sudo to install some packages: ${DEBS[*]}" + # mandatory or other apt-get commands fail + sudo apt-get update -qq -o=Dpkg::Use-Pty=0 + # avoid outdated ansible and pipx + sudo apt-get remove -y ansible pipx || true + # install all required packages + sudo apt-get -qq install -y \ + --no-install-recommends \ + --no-install-suggests \ + -o=Dpkg::Use-Pty=0 "${DEBS[@]}" + fi +fi +# log notice "Using $(python3 --version)" +log notice "xvfb installation done" + cleanup() { rv=$? pgrep xvfb-run | xargs --no-run-if-empty sudo kill || true