From 677414730b21b1932c4a1d708829e290f8e9df1e Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Fri, 13 Jan 2023 15:28:40 +0100 Subject: [PATCH] Fail faster on CI when Linux bootstrap fails Raise an exception when dependencies fail to install. Also split the run phase of the Linux bootstrap so that either of these failing commands will cause the job to fail. --- .github/workflows/main.yml | 9 ++++----- .github/workflows/pull-request.yml | 9 ++++----- python/servo/bootstrap.py | 10 ++++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72b0ecd3e2b..6343747e171 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -222,11 +222,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 - - name: Bootstrap - run: | - python3 -m pip install --upgrade pip virtualenv - sudo apt update - python3 ./mach bootstrap + - name: Bootstrap Python + run: python3 -m pip install --upgrade pip virtualenv + - name: Bootstrap dependencies + run: sudo apt update && python3 ./mach bootstrap - name: Release build run: python3 ./mach build --release - name: Lockfile check diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0c5f7ad3165..34099f1f58a 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -15,11 +15,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 - - name: Bootstrap - run: | - python3 -m pip install --upgrade pip virtualenv - sudo apt update - python3 ./mach bootstrap + - name: Bootstrap Python + run: python3 -m pip install --upgrade pip virtualenv + - name: Bootstrap dependencies + run: sudo apt update && python3 ./mach bootstrap - name: Release build run: python3 ./mach build --release - name: Unit tests diff --git a/python/servo/bootstrap.py b/python/servo/bootstrap.py index f14f9381a60..8d6b19fb477 100644 --- a/python/servo/bootstrap.py +++ b/python/servo/bootstrap.py @@ -59,11 +59,13 @@ def install_linux_deps(context, pkgs_ubuntu, pkgs_fedora, pkgs_void, force): install = force = True break - if install: - print("Installing missing dependencies...") - run_as_root(command + pkgs, force) + if not install: + return False - return install + print("Installing missing dependencies...") + if run_as_root(command + pkgs, force) != 0: + raise Exception("Installation of dependencies failed.") + return True def install_salt_dependencies(context, force):