From 2dc2c8de3b180534c51d33df549f063933ea718e Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 2 Feb 2023 15:19:26 -0600 Subject: [PATCH] Fix FreeBSD CI builds of rust-enabled codebase Use rustup to install the latest version of rust. The latest version of rust available from pkg is 1.66.0 while the code currently needs 1.67.0 or later. --- .cirrus.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 7bd954801..03121b474 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -83,12 +83,14 @@ freebsd_task: image_family: freebsd-14-0-snap - name: FreeBSD 13 freebsd_instance: - image: freebsd-13-0-release-amd64 + image: freebsd-13-1-release-amd64 - name: FreeBSD 12.3 freebsd_instance: image: freebsd-12-3-release-amd64 tests_script: - - pkg install -y cmake devel/pcre2 devel/ninja misc/py-pexpect git + - pkg install -y cmake-core devel/pcre2 devel/ninja misc/py-pexpect git-lite + # libclang.so is a required build dependency for rust-c++ ffi bridge + - pkg install -y llvm # BSDs have the following behavior: root may open or access files even if # the mode bits would otherwise disallow it. For example root may open() # a file with write privileges even if the file has mode 400. This breaks @@ -99,8 +101,16 @@ freebsd_task: - mkdir build && cd build - chown -R fish-user .. - sudo -u fish-user -s whoami + # FreeBSD's pkg currently has rust 1.66.0 while we need rust 1.67.0+. Use rustup to install + # the latest, but note that it only installs rust per-user. + - sudo -u fish-user -s fetch -qo - https://sh.rustup.rs > rustup.sh + - sudo -u fish-user -s sh ./rustup.sh -y --profile=minimal + # `sudo -s ...` does not invoke a login shell so we need a workaround to make sure the + # rustup environment is configured for subsequent `sudo -s ...` commands. + # For some reason, this doesn't do the job: + # - sudo -u fish-user sh -c 'echo source \$HOME/.cargo/env >> $HOME/.cshrc' - sudo -u fish-user -s cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=1 .. - - sudo -u fish-user -s ninja -j 6 fish fish_tests - - sudo -u fish-user -s ninja fish_run_tests + - sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja -j 6 fish fish_tests' + - sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja fish_run_tests' only_if: $CIRRUS_REPO_OWNER == 'fish-shell'