From f0b15ceab6c7e881f4e0a41baa1d551c73a20eba 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 | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) 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..4fcb3969 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 @@ -24,7 +49,7 @@ cleanup() { if [[ -f "/usr/bin/apt-get" ]]; then trap "cleanup" SIGINT SIGTERM ERR EXIT - xvfb-run --auto-servernum task devel -- ../ansible-language-server + sudo xvfb-run -e /dev/stdout --auto-servernum task devel -- ../ansible-language-server else task devel -- ../ansible-language-server fi